pub struct ThemeDefaults {Show 36 fields
pub font: FontSpec,
pub line_height: Option<f32>,
pub mono_font: FontSpec,
pub background_color: Option<Rgba>,
pub text_color: Option<Rgba>,
pub accent_color: Option<Rgba>,
pub accent_text_color: Option<Rgba>,
pub surface_color: Option<Rgba>,
pub muted_color: Option<Rgba>,
pub shadow_color: Option<Rgba>,
pub link_color: Option<Rgba>,
pub selection_background: Option<Rgba>,
pub selection_text_color: Option<Rgba>,
pub selection_inactive_background: Option<Rgba>,
pub text_selection_background: Option<Rgba>,
pub text_selection_color: Option<Rgba>,
pub disabled_text_color: Option<Rgba>,
pub danger_color: Option<Rgba>,
pub danger_text_color: Option<Rgba>,
pub warning_color: Option<Rgba>,
pub warning_text_color: Option<Rgba>,
pub success_color: Option<Rgba>,
pub success_text_color: Option<Rgba>,
pub info_color: Option<Rgba>,
pub info_text_color: Option<Rgba>,
pub border: BorderSpec,
pub disabled_opacity: Option<f32>,
pub focus_ring_color: Option<Rgba>,
pub focus_ring_width: Option<f32>,
pub focus_ring_offset: Option<f32>,
pub icon_sizes: IconSizes,
pub font_dpi: Option<f32>,
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_color,disabled_opacity,line_height, etc.) —Nonemeans “not set.” During merge, an overlay’sSomevalue replaces the base wholesale. -
Non-Option nested struct fields (
font,mono_font,border,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_color set?” is
defaults.accent_color.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_color: Option<Rgba>Main window/surface background color.
text_color: Option<Rgba>Default text color.
accent_color: Option<Rgba>Accent/brand color for interactive elements.
accent_text_color: Option<Rgba>Text color used on accent-colored backgrounds.
surface_color: Option<Rgba>Elevated surface color (cards, dialogs, popovers).
muted_color: Option<Rgba>Secondary/subdued text color.
shadow_color: Option<Rgba>Drop shadow color (with alpha).
link_color: Option<Rgba>Hyperlink text color.
selection_background: Option<Rgba>Selection highlight background.
selection_text_color: Option<Rgba>Text color over selection highlight.
selection_inactive_background: Option<Rgba>Selection background when window is unfocused.
text_selection_background: Option<Rgba>Text selection background (inline text highlight).
text_selection_color: Option<Rgba>Text selection color (inline text highlight).
disabled_text_color: Option<Rgba>Text color for disabled controls.
danger_color: Option<Rgba>Danger/error color.
danger_text_color: Option<Rgba>Text color on danger-colored backgrounds.
warning_color: Option<Rgba>Warning color.
warning_text_color: Option<Rgba>Text color on warning-colored backgrounds.
success_color: Option<Rgba>Success/confirmation color.
success_text_color: Option<Rgba>Text color on success-colored backgrounds.
info_color: Option<Rgba>Informational color.
info_text_color: Option<Rgba>Text color on info-colored backgrounds.
border: BorderSpecBorder sub-struct (color, corner_radius, line_width, etc.).
disabled_opacity: Option<f32>Opacity for disabled controls (0.0–1.0).
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.
icon_sizes: IconSizesPer-context icon sizes.
font_dpi: Option<f32>Font DPI for pt-to-px conversion. When Some(dpi), font sizes
in this variant are in typographic points and will be converted
during resolution: px = pt * font_dpi / 72. When None,
into_resolved() auto-detects
the DPI from the OS.
This is a runtime value — not stored in TOML presets. OS readers auto-detect it from system settings. Applications can override it via the Rust API (e.g. when a window moves between monitors with different DPIs).
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