Expand description
Theme tokens and their application to egui.
The canonical palettes, contrast math, and Theme Studio logic live in
crisol_core::theme. This module is the UI adapter: Theme exposes the same
nineteen-year-stable Color32 fields the workbench has always used, and every
conversion is a lossless byte copy (PIX-COL-01, PIX-COL-02).
Nine stable theme identifiers cover the GitHub, Dracula, and One Dark Pro families.
Every color the shell paints comes from Theme or from the egui visuals that
apply_id derives from it; components never invent a literal color (the only
exceptions are the window close button’s red hover and white glyph, as on Windows
and GNOME). Contrast is checked in tests against WCAG 2.2 AA.
Structs§
- Theme
- The color tokens of one theme.
Enums§
- ThemeId
- A stable theme identifier.
- Theme
Import Error serde - Why a VS Code theme could not be imported.
- Theme
Mode - The light or dark base of a theme.
Constants§
- ANIMATION_
TIME - Duration of every hover, tab, and switch animation, in seconds.
Functions§
- apply
- Apply the GitHub light or dark theme.
- apply_
id - Apply a theme identifier: visuals, widget states, spacing, scrollbars, and type scale.
- apply_
theme - Apply a theme, following the system light/dark preference when requested.
- apply_
tokens - Apply any set of tokens, built-in or your own (see
Theme::with_accentandTheme::accessibility_issues). The light or dark egui base followsTheme::is_dark; the installedcrate::style::WorkbenchStyleis kept. - contrast_
ratio - Contrast ratio between two opaque colors, from 1.0 to 21.0.
- current
- The tokens of the theme last applied with
apply_id(orapply_theme). - effective_
id - Resolve a theme against the system preference, keeping its family.
- mix
ablended towardsbbyt(0 =a, 1 =b), in sRGB.- motion_
enabled - Whether animations are on (reduced motion sets the animation time to zero).
- readable_
on - White or
dark, whichever reads better onfill(for text on colored buttons). - relative_
luminance - Relative luminance of an sRGB color (WCAG 2.2).
- set_
reduced_ motion - Turn animations off for reduced-motion preferences, or back on.
- system_
is_ dark - Whether the desktop currently prefers a dark theme.