Color

Stable

RGB colour, blending and terminal palettes for Go

Used by ViF, Stapes, LogWisp, Symph and Terminal

24-bit RGB colour for Go, with no dependencies: blend operations, perceptual distance, about 120 named colours, hex parsing, and quantization to the xterm 256 and ANSI 16 palettes for terminals that lack true colour.

  • One three-byte RGB type, which Go’s image packages take as it is
  • Blend, soft light, overlay, screen and additive operations, pure and table-driven
  • Redmean perceptual distance, and a constant-time map to the xterm 256 colours
  • About 120 named colours, and hex parsing