Expand description
The colours: light and dark, three contrast levels, an accent of the user’s.
A theme is a grid. Its rows are Tones — lightness levels from the sunken
background to strong text — and its columns are Swatches, each a hue and a chroma.
Every colour is one cell, so every colour, the accent and the status colours alike,
takes its lightness from where it is used: switching light and dark, or the contrast,
carries all of them with it.
The lightness is OKLCH’s, which follows perceived lightness: one tone gives about the same contrast whatever the hue.
Structs§
- Theme
- The colours of one theme: every
Toneof everySwatch, worked out when built. - Theme
Settings - What the user chose: what the app saves, and hands to
installat start. - Tint
Picker - Picks a
Tint: a palette (Default, the theme’s swatches, Random) over a disk of hues around and chromas outwards, and optionally a preview of the tint in use.
Enums§
- Contrast
- How far apart the text and the background are.
- Swatch
- A hue and a chroma. Red to Purple line up with Base16’s base08 to base0E.
- Tint
- A colour with no lightness of its own: where it is used decides that.
- Tone
- A lightness level, from the background side to the text side.
Functions§
- current
- The theme
ctxdraws with now: the dark or the light one, as egui’s theme is. Beforeinstall, the default settings’ (egui’s own look is left as it is). - install
- Use
settingsinctx: build the light and the dark theme, give egui both looks, and followsettings.preference. Call it at start and whenever the settings change. - is_
installed - Whether
installhas been called onctx. - settings_
ui - Light / dark / system, the contrast, and the accent (a
TintPickerwith its preview). A change isinstalled at once, so dragging on the accent’s disk previews live;truecomes once the change is made — a click, or the end of a drag — so savesettingsthen.