zest-theme
zest-theme contains the theme types used by the zest crate family.
The crate is built around a grouped theme model:
Theme<'a, C>as the top-level theme valueContainer<C>for region colors such asbackground,primary, andsecondaryComponent<C>for interactive roles such asbutton,accent,destructive, andsuccessPalette<C>for named primitive colorsTypography<'a>for the display / heading / body / caption font rolesSpacingandCornerRadiifor shared layout values
Theme is generic over embedded_graphics::pixelcolor::PixelColor, and the preset theme modules are defined as Theme<'static, Rgb888> constants.
What the crate exports
The public surface includes:
ThemeContainerComponentPaletteTypographySpacingCornerRadiiButtonAppearance,ButtonCatalog,ButtonClass, andStatusconvert_theme(...)- built-in mono font constants:
FONT_ZEST_MONOFONT_ZEST_MONO_DISPLAYFONT_ZEST_MONO_HEADINGFONT_ZEST_MONO_CAPTION
Preset themes
zest-theme::theme currently exports these preset modules:
light,darkdracula,dracula_at_nightnordcatppuccin_latte,catppuccin_frappe,catppuccin_macchiato,catppuccin_mochatokyo_night,tokyo_night_storm,tokyo_night_lightkanagawa_wave,kanagawa_dragon,kanagawa_lotusmoonfly,nightflyoxocarbonferra
Each preset module exports a THEME constant.
Converting a preset to your display color
use Rgb565;
use ;
let theme: = convert_theme;
Building a custom theme
The crate also includes theme::custom::CustomBuilder, which starts from the dark or light preset and lets you replace individual fields.
use CustomBuilder;
let custom = from_dark.build;
Notes
- The crate is
no_stdoutside tests. - Widgets do not consume the theme by reaching directly into every field;
Themeimplements catalog traits such asButtonCatalog, and widget code uses those role-based lookups.