Modulegranite-0.7.4.0GHC2021
Granite.Color
Color primitives shared by the terminal and SVG backends.
Color is a 24-bit RGB value. The classic ANSI palette names (Black, BrightBlue, Default, …) are provided as bidirectional pattern synonyms that expand to fixed RGB triples, so they may be used both as expressions and in patterns exactly as before.
The two backends deliberately diverge on how a colour is realised:
the SVG backend renders the RGB exactly via colorHex;
the terminal backend approximates via ansiCode, which maps an arbitrary colour to the nearest of the 16 ANSI slots.
Because Color is now a plain RGB triple, its derived Show prints
Color r g b rather than the alias name.
- 1 type
- 8 values
- Packagegranite-0.7.4.0
- Exports26
- LanguageGHC2021
- LicenceMIT
- SourceColor.hs
ANSI escape code for a colour. The 16 named slots (plus Default) return their canonical code; any other colour maps to the nearest ANSI slot.
Opening ANSI escape sequence selecting a colour (its nearest ANSI slot).
ANSI reset escape sequence.
Wrap a character in ANSI on/off sequences. Spaces pass through unchanged.
Exact #rrggbb rendering of a colour, used by the SVG backend.
Default palette for layered charts (scatter, line, bars, …).
Palette used by pie / box plots (categorical, more saturated).