Struct egui::style::Visuals

source ·
pub struct Visuals {
Show 22 fields pub dark_mode: bool, pub override_text_color: Option<Color32>, pub widgets: Widgets, pub selection: Selection, pub hyperlink_color: Color32, pub faint_bg_color: Color32, pub extreme_bg_color: Color32, pub code_bg_color: Color32, pub warn_fg_color: Color32, pub error_fg_color: Color32, pub window_rounding: Rounding, pub window_shadow: Shadow, pub window_fill: Color32, pub window_stroke: Stroke, pub panel_fill: Color32, pub popup_shadow: Shadow, pub resize_corner_size: f32, pub text_cursor_width: f32, pub text_cursor_preview: bool, pub clip_rect_margin: f32, pub button_frame: bool, pub collapsing_header_frame: bool,
}
Expand description

Controls the visual style (colors etc) of egui.

You can change the visuals of a Ui with Ui::visuals_mut and of everything with crate::Context::set_visuals.

If you want to change fonts, use crate::Context::set_fonts instead.

Fields§

§dark_mode: bool

If true, the visuals are overall dark with light text. If false, the visuals are overall light with dark text.

NOTE: setting this does very little by itself, this is more to provide a convenient summary of the rest of the settings.

§override_text_color: Option<Color32>

Override default text color for all text.

This is great for setting the color of text for any widget.

If text_color is None (default), then the text color will be the same as the foreground stroke color (WidgetVisuals::fg_stroke) and will depend on whether or not the widget is being interacted with.

In the future we may instead modulate the text_color based on whether or not it is interacted with so that visuals.text_color is always used, but its alpha may be different based on whether or not it is disabled, non-interactive, hovered etc.

§widgets: Widgets

Visual styles of widgets

§selection: Selection§hyperlink_color: Color32

The color used for Hyperlink,

§faint_bg_color: Color32

Something just barely different from the background color. Used for crate::Grid::striped.

§extreme_bg_color: Color32

Very dark or light color (for corresponding theme). Used as the background of text edits, scroll bars and others things that needs to look different from other interactive stuff.

§code_bg_color: Color32

Background color behind code-styled monospaced labels.

§warn_fg_color: Color32

A good color for warning text (e.g. orange).

§error_fg_color: Color32

A good color for error text (e.g. red).

§window_rounding: Rounding§window_shadow: Shadow§window_fill: Color32§window_stroke: Stroke§panel_fill: Color32

Panel background color

§popup_shadow: Shadow§resize_corner_size: f32§text_cursor_width: f32§text_cursor_preview: bool

show where the text cursor would be if you clicked

§clip_rect_margin: f32

Allow child widgets to be just on the border and still have a stroke with some thickness

§button_frame: bool

Show a background behind buttons.

§collapsing_header_frame: bool

Show a background behind collapsing headers.

Implementations§

Window background color.

When fading out things, we fade the colors towards this.

Returned a “grayed out” version of the given color.

Default dark theme.

Default light theme.

Show radio-buttons to switch between light and dark mode.

Show small toggle-button for light and dark mode.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more