pub struct ThemeDefaults {Show 39 fields
pub font: FontSpec,
pub line_height: Option<f32>,
pub mono_font: FontSpec,
pub background: Option<Rgba>,
pub foreground: Option<Rgba>,
pub accent: Option<Rgba>,
pub accent_foreground: Option<Rgba>,
pub surface: Option<Rgba>,
pub border: Option<Rgba>,
pub muted: Option<Rgba>,
pub shadow: Option<Rgba>,
pub link: Option<Rgba>,
pub selection: Option<Rgba>,
pub selection_foreground: Option<Rgba>,
pub selection_inactive: Option<Rgba>,
pub disabled_foreground: Option<Rgba>,
pub danger: Option<Rgba>,
pub danger_foreground: Option<Rgba>,
pub warning: Option<Rgba>,
pub warning_foreground: Option<Rgba>,
pub success: Option<Rgba>,
pub success_foreground: Option<Rgba>,
pub info: Option<Rgba>,
pub info_foreground: Option<Rgba>,
pub radius: Option<f32>,
pub radius_lg: Option<f32>,
pub frame_width: Option<f32>,
pub disabled_opacity: Option<f32>,
pub border_opacity: Option<f32>,
pub shadow_enabled: Option<bool>,
pub focus_ring_color: Option<Rgba>,
pub focus_ring_width: Option<f32>,
pub focus_ring_offset: Option<f32>,
pub spacing: ThemeSpacing,
pub icon_sizes: IconSizes,
pub text_scaling_factor: Option<f32>,
pub reduce_motion: Option<bool>,
pub high_contrast: Option<bool>,
pub reduce_transparency: Option<bool>,
}Expand description
Global theme defaults shared across all widgets.
§Field structure
This struct uses two patterns for its fields:
-
Option<T>leaf fields (accent,radius,line_height, etc.) —Nonemeans “not set.” During merge, an overlay’sSomevalue replaces the base wholesale. -
Non-Option nested struct fields (
font,mono_font,spacing,icon_sizes) — these support partial field-by-field override during merge. For example, an overlay that sets onlyfont.sizewill inherit the base’sfont.familyandfont.weight. This makes theme merging more flexible: you can fine-tune individual properties without replacing the entire sub-struct.
This asymmetry is intentional. Checking “is accent set?” is
defaults.accent.is_some(), while checking “is font set?” requires
inspecting individual fields like defaults.font.family.is_some().
When resolving a widget’s properties, None on the widget struct
means “inherit from ThemeDefaults”.
Fields§
§font: FontSpecPrimary UI font (family, size, weight).
line_height: Option<f32>Line height multiplier (e.g. 1.4 = 140% of font size).
mono_font: FontSpecMonospace font for code/terminal content.
background: Option<Rgba>Main window/surface background color.
foreground: Option<Rgba>Default text color.
accent: Option<Rgba>Accent/brand color for interactive elements.
accent_foreground: Option<Rgba>Text color used on accent-colored backgrounds.
surface: Option<Rgba>Elevated surface color (cards, dialogs, popovers).
border: Option<Rgba>Border/divider color.
muted: Option<Rgba>Secondary/subdued text color.
shadow: Option<Rgba>Drop shadow color (with alpha).
link: Option<Rgba>Hyperlink text color.
selection: Option<Rgba>Selection highlight background.
selection_foreground: Option<Rgba>Text color over selection highlight.
selection_inactive: Option<Rgba>Selection background when window is unfocused.
disabled_foreground: Option<Rgba>Text color for disabled controls.
danger: Option<Rgba>Danger/error color.
danger_foreground: Option<Rgba>Text color on danger-colored backgrounds.
warning: Option<Rgba>Warning color.
warning_foreground: Option<Rgba>Text color on warning-colored backgrounds.
success: Option<Rgba>Success/confirmation color.
success_foreground: Option<Rgba>Text color on success-colored backgrounds.
info: Option<Rgba>Informational color.
info_foreground: Option<Rgba>Text color on info-colored backgrounds.
radius: Option<f32>Default corner radius in logical pixels.
radius_lg: Option<f32>Large corner radius (dialogs, floating panels).
frame_width: Option<f32>Border/frame width in logical pixels.
disabled_opacity: Option<f32>Opacity for disabled controls (0.0–1.0).
border_opacity: Option<f32>Border alpha multiplier (0.0–1.0).
shadow_enabled: Option<bool>Whether drop shadows are enabled.
focus_ring_color: Option<Rgba>Focus indicator outline color.
focus_ring_width: Option<f32>Focus indicator outline width.
focus_ring_offset: Option<f32>Gap between element edge and focus indicator.
spacing: ThemeSpacingLogical spacing scale (xxs through xxl).
icon_sizes: IconSizesPer-context icon sizes.
text_scaling_factor: Option<f32>Text scaling factor (1.0 = no scaling).
reduce_motion: Option<bool>Whether the user has requested reduced motion.
high_contrast: Option<bool>Whether a high-contrast mode is active.
reduce_transparency: Option<bool>Whether the user has requested reduced transparency.
Implementations§
Source§impl ThemeDefaults
impl ThemeDefaults
Sourcepub const FIELD_NAMES: &[&str]
pub const FIELD_NAMES: &[&str]
All serialized field names for ThemeDefaults, for TOML linting.
Source§impl ThemeDefaults
impl ThemeDefaults
Trait Implementations§
Source§impl Clone for ThemeDefaults
impl Clone for ThemeDefaults
Source§fn clone(&self) -> ThemeDefaults
fn clone(&self) -> ThemeDefaults
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more