Trait Aesthetix

Source
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§

Source

fn name(&self) -> &str

The name of the theme for debugging and comparison purposes.

Source

fn primary_accent_color_visuals(&self) -> Color32

The primary accent color of the theme.

Source

fn secondary_accent_color_visuals(&self) -> Color32

The secondary accent color of the theme.

Source

fn bg_primary_color_visuals(&self) -> Color32

Used for the main background color of the app.

  • This value is used for eguis panel_fill and window_fill fields
Source

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
Source

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
Source

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
Source

fn bg_contrast_color_visuals(&self) -> Color32

The color for hyperlinks, and border contrasts.

Source

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.

Source

fn fg_success_text_color_visuals(&self) -> Color32

Success color for text.

Source

fn fg_warn_text_color_visuals(&self) -> Color32

Warning text color.

Source

fn fg_error_text_color_visuals(&self) -> Color32

Error text color.

Source

fn dark_mode_visuals(&self) -> bool

Visual dark mode. True specifies a dark mode, false specifies a light mode.

Source

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
Source

fn button_padding(&self) -> Vec2

Button size is text size plus this on each side.

  • Egui default is { x: 6.0, y: 4.0 }
Source

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
Source

fn scroll_bar_width_style(&self) -> f32

Scroll bar width.

  • Egui default is 6.0
Source

fn rounding_visuals(&self) -> f32

Custom rounding value for all buttons and frames.

  • Egui default is 4.0

Provided Methods§

Source

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
Source

fn interaction_style(&self) -> Interaction

How and when interaction happens.

Source

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.

Source

fn widget_inactive_visual(&self) -> WidgetVisuals

The style of an interactive widget, such as a button, at rest.

Source

fn widget_hovered_visual(&self) -> WidgetVisuals

The style of an interactive widget while you hover it, or when it is highlighted

Source

fn custom_active_widget_visual(&self) -> WidgetVisuals

The style of an interactive widget as you are clicking or dragging it.

Source

fn custom_open_widget_visual(&self) -> WidgetVisuals

The style of a button that has an open menu beneath it (e.g. a combo-box)

Source

fn custom_selection_visual(&self) -> Selection

Uses the primary and secondary accent colors to build a custom selection style.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for dyn Aesthetix

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for dyn Aesthetix

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Implementors§