diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2017-01-10 02:16:12 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2017-01-10 02:16:12 +0900 |
| commit | ae274158de38181bca27f2ce54c8b4fc0b688eff (patch) | |
| tree | 1bcecf4123c33640a0d6c57147b17920aea0ee7e /src/tui/tui_test.go | |
| parent | 340af463cd9c52c0a3a7ea5688035bba1cd29f6a (diff) | |
| download | fzf-ae274158de38181bca27f2ce54c8b4fc0b688eff.tar.gz | |
Add experimental support for 24-bit colors
Diffstat (limited to 'src/tui/tui_test.go')
| -rw-r--r-- | src/tui/tui_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/tui/tui_test.go b/src/tui/tui_test.go new file mode 100644 index 00000000..3ba9bf35 --- /dev/null +++ b/src/tui/tui_test.go @@ -0,0 +1,20 @@ +package tui + +import "testing" + +func TestHexToColor(t *testing.T) { + assert := func(expr string, r, g, b int) { + color := HexToColor(expr) + if !color.is24() || + int((color>>16)&0xff) != r || + int((color>>8)&0xff) != g || + int((color)&0xff) != b { + t.Fail() + } + } + + assert("#ff0000", 255, 0, 0) + assert("#010203", 1, 2, 3) + assert("#102030", 16, 32, 48) + assert("#ffffff", 255, 255, 255) +} |
