pub struct ThemeDefaults {Show 32 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: DefaultsBorderSpec,
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 icon_theme: Option<Cow<'static, str>>,
}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, before disabled_opacity fades the
widget: the enabled text colour where the platform dims by opacity.
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: DefaultsBorderSpecBorder sub-struct (color, corner_radius, line_width, etc.).
disabled_opacity: Option<f32>Opacity for disabled controls (0.0–1.0), applied to the whole widget.
A consumer applies both this and the disabled colours
(disabled_text_color, each widget’s disabled_*). A platform dims by
one mechanism, and the data makes the other an identity: 1.0 where the
platform dims by colour (KDE, Windows), and disabled colours equal to
the enabled ones where it dims by opacity (GNOME;
docs/platform-facts.md §2.1.6). A widget with no disabled_opacity
of its own (menu, list, link) fades by this one.
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.
icon_theme: Option<Cow<'static, str>>Visual icon theme name for this variant — OVERRIDE of
crate::Theme::icon_theme.
When a theme uses the same icon theme for both light and dark variants,
prefer declaring it at crate::Theme::icon_theme (shared across
variants). Set this per-variant override only when the value differs
by color mode — for example KDE Plasma’s "breeze" (light) vs
"breeze-dark" (dark).
Precedence at resolve time:
ThemeDefaults::icon_theme(this field, per-variant override) — if setcrate::Theme::icon_theme(shared across variants) — if setcrate::model::icons::system_icon_theme()(runtime detection; none where it fails)
See docs/archive/v0.5.7_gaps.md §G4 for the rationale.