pub struct Theme {
pub bg: Color,
pub panel_bg: Color,
pub border: Color,
pub title_bg: Color,
pub fg: Color,
pub accent: Color,
pub hover_bg: Color,
pub press_bg: Color,
pub dim: Color,
}Expand description
A palette of named color roles, rather than a CSS-style cascade: draw
code picks the role it means (theme.accent, theme.border) and the
active Theme decides what color that resolves to.
This crate has no opinion on how an app picks between
DARK and LIGHT (a manual toggle key, a
SystemTheme from
Event::ThemeChanged, or just
always the same one): it only owns the two palettes themselves, so an
app doesn’t have to invent one from scratch.
§Examples
use retroglyph_widgets::Theme;
let theme = Theme::DARK;
assert_eq!(theme.fg, Theme::DARK.fg);
assert_ne!(theme.bg, Theme::LIGHT.bg);Fields§
§bg: ColorThe window/screen background, behind every panel.
panel_bg: ColorA panel’s own background, layered over bg.
border: ColorPanel borders and dividers.
title_bg: ColorA panel title bar’s background.
fg: ColorDefault (non-emphasized) text.
accent: ColorEmphasis: selection, focus rings, primary actions.
hover_bg: ColorAn interactive widget’s background while hovered.
press_bg: ColorAn interactive widget’s background while pressed.
dim: ColorDe-emphasized text (hints, secondary labels, disabled-looking text).
Implementations§
Source§impl Theme
impl Theme
Sourcepub const LIGHT: Self
pub const LIGHT: Self
A light palette: dark text on a near-white background. Same role
relationships as DARK (accent stays a legible blue,
hover_bg/press_bg stay a step apart from panel_bg), inverted
for contrast against a light background rather than just flipping
each channel.
Contrast is higher than a typical OS light theme: retroglyph’s pseudo-graphics (gauges, progress bars, log lines) draw with a 2-color paletted look where every panel-bg/border/text pair has to be distinct at a glance with no sub-pixel anti-aliasing to soften the edges.