Documentation ¶
Overview ¶
Convert between truecolor, xterm(1) 256 color and 16 color. Single-header library. Arranged from tmux.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RgbTo256 ¶
RgbTo256 converts an RGB triplet to the xterm(1) 256 color palette.
xterm provides a 6x6x6 color cube (16 - 231) and 24 greys (232 - 255). We map our RGB color to the closest in the cube, also work out the closest grey, and use the nearest of the two.
Note that the xterm has much lower resolution for darker colors (they are not evenly spread out), so our 6 levels are not evenly spread: 0x0, 0x5f (95), 0x87 (135), 0xaf (175), 0xd7 (215) and 0xff (255). Greys are more evenly spread (8, 18, 28 ... 238).
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.