pub trait Aesthetix {
Show 28 methods
// Required methods
fn name(&self) -> &str;
fn primary_accent_color_visuals(&self) -> Color32;
fn secondary_accent_color_visuals(&self) -> Color32;
fn bg_primary_color_visuals(&self) -> Color32;
fn bg_secondary_color_visuals(&self) -> Color32;
fn bg_triage_color_visuals(&self) -> Color32;
fn bg_auxiliary_color_visuals(&self) -> Color32;
fn bg_contrast_color_visuals(&self) -> Color32;
fn fg_primary_text_color_visuals(&self) -> Option<Color32>;
fn fg_success_text_color_visuals(&self) -> Color32;
fn fg_warn_text_color_visuals(&self) -> Color32;
fn fg_error_text_color_visuals(&self) -> Color32;
fn dark_mode_visuals(&self) -> bool;
fn margin_style(&self) -> f32;
fn button_padding(&self) -> Vec2;
fn item_spacing_style(&self) -> f32;
fn scroll_bar_width_style(&self) -> f32;
fn rounding_visuals(&self) -> f32;
// Provided methods
fn spacing_style(&self) -> Spacing { ... }
fn interaction_style(&self) -> Interaction { ... }
fn custom_noninteractive_widget_visuals(&self) -> WidgetVisuals { ... }
fn widget_inactive_visual(&self) -> WidgetVisuals { ... }
fn widget_hovered_visual(&self) -> WidgetVisuals { ... }
fn custom_active_widget_visual(&self) -> WidgetVisuals { ... }
fn custom_open_widget_visual(&self) -> WidgetVisuals { ... }
fn custom_selection_visual(&self) -> Selection { ... }
fn custom_text_styles(&self) -> BTreeMap<TextStyle, FontId> { ... }
fn custom_style(&self) -> Style { ... }
}
Expand description
Every custom egui theme that wishes to use the egui aesthetix crate must implement this trait. Aesthetix is structured in such a way that it is easy to customize the theme to your liking.
The trait is split into two parts:
-
The first part are the methods that have no implementation, these should just return self-explanatory values.
-
The second part are the methods that have a default implementation, they are more complex and use all the user defined methods. the fields in these traits that don’t use trait methods as values are niche and can be ignored if you don’t want to customize them. If the user really wants to customize these fields, they can override the method easily enough, just copy the method you wish to override and do so. All of eguis style fields can be found here.
Required Methods§
Sourcefn primary_accent_color_visuals(&self) -> Color32
fn primary_accent_color_visuals(&self) -> Color32
The primary accent color of the theme.
Sourcefn secondary_accent_color_visuals(&self) -> Color32
fn secondary_accent_color_visuals(&self) -> Color32
The secondary accent color of the theme.
Sourcefn bg_primary_color_visuals(&self) -> Color32
fn bg_primary_color_visuals(&self) -> Color32
Used for the main background color of the app.
- This value is used for eguis
panel_fill
andwindow_fill
fields
Sourcefn bg_secondary_color_visuals(&self) -> Color32
fn bg_secondary_color_visuals(&self) -> Color32
Something just barely different from the background color.
- This value is used for eguis
faint_bg_color
field
Sourcefn bg_triage_color_visuals(&self) -> Color32
fn bg_triage_color_visuals(&self) -> 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.
- This value is used for eguis
extreme_bg_color
field
Sourcefn bg_auxiliary_color_visuals(&self) -> Color32
fn bg_auxiliary_color_visuals(&self) -> Color32
Background color behind code-styled monospaced labels. Back up lighter than the background primary, secondary and triage colors.
- This value is used for eguis
code_bg_color
field
Sourcefn bg_contrast_color_visuals(&self) -> Color32
fn bg_contrast_color_visuals(&self) -> Color32
The color for hyperlinks, and border contrasts.
Sourcefn fg_primary_text_color_visuals(&self) -> Option<Color32>
fn fg_primary_text_color_visuals(&self) -> Option<Color32>
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 and will depend on whether the widget is being interacted with.
Sourcefn fg_success_text_color_visuals(&self) -> Color32
fn fg_success_text_color_visuals(&self) -> Color32
Success color for text.
Sourcefn fg_warn_text_color_visuals(&self) -> Color32
fn fg_warn_text_color_visuals(&self) -> Color32
Warning text color.
Sourcefn fg_error_text_color_visuals(&self) -> Color32
fn fg_error_text_color_visuals(&self) -> Color32
Error text color.
Sourcefn dark_mode_visuals(&self) -> bool
fn dark_mode_visuals(&self) -> bool
Visual dark mode. True specifies a dark mode, false specifies a light mode.
Sourcefn margin_style(&self) -> f32
fn margin_style(&self) -> f32
Horizontal and vertical margins within a menu frame. This value is used for all margins, in windows, panes, frames etc. Using the same value will yield a more consistent look.
- Egui default is 6.0
Button size is text size plus this on each side.
- Egui default is { x: 6.0, y: 4.0 }
Sourcefn item_spacing_style(&self) -> f32
fn item_spacing_style(&self) -> f32
Horizontal and vertical spacing between widgets.
If you want to override this for special cases use the add_space
method.
This single value is added for the x and y coordinates to yield a more consistent look.
- Egui default is 4.0
Sourcefn scroll_bar_width_style(&self) -> f32
fn scroll_bar_width_style(&self) -> f32
Scroll bar width.
- Egui default is 6.0
Sourcefn rounding_visuals(&self) -> f32
fn rounding_visuals(&self) -> f32
Custom rounding value for all buttons and frames.
- Egui default is 4.0
Provided Methods§
Sourcefn spacing_style(&self) -> Spacing
fn spacing_style(&self) -> Spacing
Controls the sizes and distances between widgets. The following types of spacing are implemented.
- Spacing
- Margin
- Button Padding
- Scroll Bar width
Sourcefn interaction_style(&self) -> Interaction
fn interaction_style(&self) -> Interaction
How and when interaction happens.
Sourcefn custom_noninteractive_widget_visuals(&self) -> WidgetVisuals
fn custom_noninteractive_widget_visuals(&self) -> WidgetVisuals
The style of a widget that you cannot interact with.
noninteractive.bg_stroke
is the outline of windows.
noninteractive.bg_fill
is the background color of windows.
noninteractive.fg_stroke
is the normal text color.
Sourcefn widget_inactive_visual(&self) -> WidgetVisuals
fn widget_inactive_visual(&self) -> WidgetVisuals
The style of an interactive widget, such as a button, at rest.
Sourcefn widget_hovered_visual(&self) -> WidgetVisuals
fn widget_hovered_visual(&self) -> WidgetVisuals
The style of an interactive widget while you hover it, or when it is highlighted
Sourcefn custom_active_widget_visual(&self) -> WidgetVisuals
fn custom_active_widget_visual(&self) -> WidgetVisuals
The style of an interactive widget as you are clicking or dragging it.
Sourcefn custom_open_widget_visual(&self) -> WidgetVisuals
fn custom_open_widget_visual(&self) -> WidgetVisuals
The style of a button that has an open menu beneath it (e.g. a combo-box)
Sourcefn custom_selection_visual(&self) -> Selection
fn custom_selection_visual(&self) -> Selection
Uses the primary and secondary accent colors to build a custom selection style.
Sourcefn custom_text_styles(&self) -> BTreeMap<TextStyle, FontId>
fn custom_text_styles(&self) -> BTreeMap<TextStyle, FontId>
Edit text styles.
This is literally just a copy and pasted version of eguis default_text_styles
function.
Sourcefn custom_style(&self) -> Style
fn custom_style(&self) -> Style
Sets the custom style for the given original Style
.
Relies on all above trait methods to build the complete style.
Specifies the look and feel of egui.