| 1 |
package terminal |
| 2 |
|
| 3 |
// ANSI color values |
| 4 |
const ( |
| 5 |
Black Color = iota |
| 6 |
Red |
| 7 |
Green |
| 8 |
Yellow |
| 9 |
Blue |
| 10 |
Magenta |
| 11 |
Cyan |
| 12 |
LightGrey |
| 13 |
DarkGrey |
| 14 |
LightRed |
| 15 |
LightGreen |
| 16 |
LightYellow |
| 17 |
LightBlue |
| 18 |
LightMagenta |
| 19 |
LightCyan |
| 20 |
White |
| 21 |
) |
| 22 |
|
| 23 |
// Default colors are potentially distinct to allow for special behavior. |
| 24 |
// For example, a transparent background. Otherwise, the simple case is to |
| 25 |
// map default colors to another color. |
| 26 |
const ( |
| 27 |
DefaultFG Color = 0xff80 + iota |
| 28 |
DefaultBG |
| 29 |
) |
| 30 |
|
| 31 |
// Color maps to the ANSI colors [0, 16) and the xterm colors [16, 256). |
| 32 |
type Color uint16 |
| 33 |
|
| 34 |
// ANSI returns true if Color is within [0, 16). |
| 35 |
func (c Color) ANSI() bool { |
| 36 |
return (c < 16) |
| 37 |
} |