Module syntax_palette
Expand description
The one colour scheme every syntax-highlighting surface paints with: the code editor widget, block-editor code fences, highlighted text inputs and any app that renders source (a code editor, a diff, a snippet preview).
Like super::TerminalPalette it is derived from the active
Colors, never hand-authored per theme, so a theme swap recolours every
code surface coherently. Two properties hold on every preset:
- Polarity-aware steps. Keywords and type names are the presence palette’s blue moved a quarter and a half of the way toward the body text colour — away from the ground: lighter on a dark theme, darker on a light one.
- A contrast floor. Each role is walked toward the body text colour
until it clears WCAG AA against both code grounds (
surfaces.baseandsurfaces.raised); a preset whose body text sits at maximum contrast (high contrast) asks for AAA instead.
Structs§
- Syntax
Palette - Theme-derived colour for every syntax role. Read it from
theme.tokens.syntaxand resolve a token withSyntaxPalette::color.