pub struct Theme {Show 15 fields
pub primary: Color,
pub secondary: Color,
pub accent: Color,
pub text: Color,
pub text_dim: Color,
pub border: Color,
pub bg: Color,
pub success: Color,
pub warning: Color,
pub error: Color,
pub selected_bg: Color,
pub selected_fg: Color,
pub surface: Color,
pub surface_hover: Color,
pub surface_text: Color,
}Expand description
A color theme that flows through all widgets automatically.
Construct with Theme::dark() or Theme::light(), or build a custom
theme by filling in the fields directly. Pass the theme via crate::RunConfig
and every widget will pick up the colors without any extra wiring.
Fields§
§primary: ColorPrimary accent color, used for focused borders and highlights.
secondary: ColorSecondary accent color, used for less prominent highlights.
accent: ColorAccent color for decorative elements.
text: ColorDefault foreground text color.
text_dim: ColorDimmed text color for secondary labels and hints.
border: ColorBorder color for unfocused containers.
bg: ColorBackground color. Typically Color::Reset to inherit the terminal background.
success: ColorColor for success states (e.g., toast notifications).
warning: ColorColor for warning states.
error: ColorColor for error states.
selected_bg: ColorBackground color for selected list/table rows.
selected_fg: ColorForeground color for selected list/table rows.
surface: ColorSubtle surface color for card backgrounds and elevated containers.
surface_hover: ColorHover/active surface color, one step brighter than surface.
Used for interactive element hover states. Should be visually
distinguishable from both surface and border.
surface_text: ColorSecondary text color guaranteed readable on surface backgrounds.
Use this instead of text_dim when rendering on surface-colored
containers. text_dim is tuned for the main bg; on surface it
may lack contrast.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn builder() -> ThemeBuilder
pub fn builder() -> ThemeBuilder
Create a ThemeBuilder for configuring a custom theme.
§Example
use slt::{Color, Theme};
let theme = Theme::builder()
.primary(Color::Rgb(255, 107, 107))
.accent(Color::Cyan)
.build();Sourcepub fn catppuccin() -> Self
pub fn catppuccin() -> Self
Catppuccin Mocha theme — lavender primary on dark base.
Sourcepub fn solarized_dark() -> Self
pub fn solarized_dark() -> Self
Solarized Dark theme — blue primary on dark base.
Sourcepub fn tokyo_night() -> Self
pub fn tokyo_night() -> Self
Tokyo Night theme — blue primary on dark storm base.