Skip to main content

Module theme

Module theme 

Source
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.
ThemeImportErrorserde
Why a VS Code theme could not be imported.
ThemeMode
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_accent and Theme::accessibility_issues). The light or dark egui base follows Theme::is_dark; the installed crate::style::WorkbenchStyle is 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 (or apply_theme).
effective_id
Resolve a theme against the system preference, keeping its family.
mix
a blended towards b by t (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 on fill (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.