pub struct Theme {
pub primary: Color,
pub secondary: Color,
pub bg: Color,
pub fg: Color,
pub muted: Color,
pub border: Color,
pub success: Color,
pub warning: Color,
pub error: Color,
pub info: Color,
pub surface: Color,
pub highlight: Color,
}Expand description
A color palette for theming UI components.
Components reference these semantic colors rather than hard-coding values, allowing the entire UI to be restyled by swapping themes.
Fields§
§primary: ColorPrimary accent color (buttons, active elements).
secondary: ColorSecondary accent color (less prominent elements).
bg: ColorBackground color for the main content area.
fg: ColorDefault foreground/text color.
muted: ColorMuted/dimmed text color.
border: ColorBorder color for containers.
success: ColorSuccess state color.
warning: ColorWarning state color.
error: ColorError/danger state color.
info: ColorInformational state color.
surface: ColorSurface color (cards, panels, elevated elements).
highlight: ColorHighlight/selection background.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn builtins() -> &'static [BuiltinTheme]
pub fn builtins() -> &'static [BuiltinTheme]
Return the list of built-in theme presets.
Sourcepub fn builtin(theme: BuiltinTheme) -> Self
pub fn builtin(theme: BuiltinTheme) -> Self
Build one of the built-in theme presets.
Sourcepub fn from_builtin_name(name: &str) -> Option<Self>
pub fn from_builtin_name(name: &str) -> Option<Self>
Build a built-in theme from a configuration-friendly name.
Sourcepub fn roles() -> &'static [ThemeRole]
pub fn roles() -> &'static [ThemeRole]
Return the list of stable semantic roles supported by every theme.
Sourcepub fn foreground_style(&self, role: ThemeRole) -> Style
pub fn foreground_style(&self, role: ThemeRole) -> Style
Create a foreground-only style from a semantic role.
Sourcepub fn background_style(&self, role: ThemeRole) -> Style
pub fn background_style(&self, role: ThemeRole) -> Style
Create a background-only style from a semantic role.
Sourcepub fn pair_style(&self, fg: ThemeRole, bg: ThemeRole) -> Style
pub fn pair_style(&self, fg: ThemeRole, bg: ThemeRole) -> Style
Create a style from separate foreground and background roles.
Sourcepub fn selection_style(&self) -> Style
pub fn selection_style(&self) -> Style
Standard selected-row style for theme-aware widgets.
Sourcepub fn surface_style(&self) -> Style
pub fn surface_style(&self) -> Style
Standard elevated-surface style for panels and overlays.
Sourcepub fn catppuccin() -> Self
pub fn catppuccin() -> Self
Catppuccin Mocha-inspired theme.
Sourcepub fn tokyo_night() -> Self
pub fn tokyo_night() -> Self
Tokyo Night-inspired theme.