mirror of
https://github.com/walles/moar.git
synced 2024-11-22 03:14:56 +03:00
Assume 16 colors mean VGA palette
I can't see any other reason for telling moar to use 16 colors than if your hardware actually can't do more. And that means VGA.
This commit is contained in:
parent
c42ac5f66c
commit
3a4c54ed5e
@ -25,24 +25,24 @@ func color256ToRGB(color256 uint8) (r, g, b uint8) {
|
||||
return r, g, b
|
||||
}
|
||||
|
||||
// Source, the 256 colors table from here:
|
||||
// Source, the VGA color palette from here:
|
||||
// https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit
|
||||
var standardAnsiColors = [16][3]uint8{
|
||||
{0x00, 0x00, 0x00}, // Black
|
||||
{0x80, 0x00, 0x00}, // Red
|
||||
{0x00, 0x80, 0x00}, // Green
|
||||
{0x80, 0x80, 0x00}, // Yellow
|
||||
{0x00, 0x00, 0x80}, // Blue
|
||||
{0x80, 0x00, 0x80}, // Magenta
|
||||
{0x00, 0x80, 0x80}, // Cyan
|
||||
{0x80, 0x80, 0x80}, // White
|
||||
{0xAA, 0x00, 0x00}, // Red
|
||||
{0x00, 0xAA, 0x00}, // Green
|
||||
{0xAA, 0x55, 0x00}, // Yellow
|
||||
{0x00, 0x00, 0xAA}, // Blue
|
||||
{0xAA, 0x00, 0xAA}, // Magenta
|
||||
{0x00, 0xAA, 0xAA}, // Cyan
|
||||
{0xAA, 0xAA, 0xAA}, // White
|
||||
|
||||
{0x80, 0x80, 0x80}, // Bright Black
|
||||
{0xff, 0x00, 0x00}, // Bright Red
|
||||
{0x00, 0xff, 0x00}, // Bright Green
|
||||
{0xff, 0xff, 0x00}, // Bright Yellow
|
||||
{0x00, 0x00, 0xff}, // Bright Blue
|
||||
{0xff, 0x00, 0xff}, // Bright Magenta
|
||||
{0x00, 0xff, 0xff}, // Bright Cyan
|
||||
{0x55, 0x55, 0x55}, // Bright Black
|
||||
{0xff, 0x55, 0x55}, // Bright Red
|
||||
{0x55, 0xff, 0x55}, // Bright Green
|
||||
{0xff, 0xff, 0x55}, // Bright Yellow
|
||||
{0x55, 0x55, 0xff}, // Bright Blue
|
||||
{0xff, 0x55, 0xff}, // Bright Magenta
|
||||
{0x55, 0xff, 0xff}, // Bright Cyan
|
||||
{0xff, 0xff, 0xff}, // Bright White
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ import (
|
||||
func TestColorRgbFirst16(t *testing.T) {
|
||||
r, g, b := color256ToRGB(5)
|
||||
|
||||
assert.Equal(t, r, uint8(0x80))
|
||||
assert.Equal(t, r, uint8(0xaa))
|
||||
assert.Equal(t, g, uint8(0x00))
|
||||
assert.Equal(t, b, uint8(0x80))
|
||||
assert.Equal(t, b, uint8(0xaa))
|
||||
}
|
||||
|
||||
func TestColorToRgbInTheGrey(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user