Documentation ¶
Overview ¶
Package palette provides mapping for 24-bit colors to the 8-bit ANSI SGR palette.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Palette is the 256-color lookup table defined by ANSI for use with // SGR escape codes. Palette = [0x100]RGB{ {0, 0, 0}, {192, 0, 0}, {0, 192, 0}, {192, 192, 0}, {0, 0, 192}, {192, 0, 192}, {0, 192, 192}, {192, 192, 192}, {128, 128, 128}, {255, 0, 0}, {0, 255, 0}, {255, 255, 0}, {0, 0, 255}, {255, 0, 255}, {0, 255, 255}, {255, 255, 255}, } )
Functions ¶
func FindPaletteColor ¶
FindPaletteColor matches the r, g, b, color to the closest color in the 8-bit palette. The first 16 colors are not used, as the exact color for those entries are terminal dependent, and matching cannot be guarantted.
func FindSimpleColor ¶
FindSimpleColor matches the r, g, b, color to one of the first 16 entries. The first 16 entries match the colors available in the 4-bit palette.
Types ¶
Click to show internal directories.
Click to hide internal directories.