1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-05 13:05:18 +02:00
chroma/formatters/tty_indexed_test.go
Alec Thomas 0961f82bc3 Fix nearest colour matching.
This was caused by precision loss due to using uint8. The cast to int64
was occurring in the wrong location.

Fixes #145.
2018-06-25 20:48:31 +10:00

14 lines
283 B
Go

package formatters
import (
"testing"
"github.com/alecthomas/assert"
"github.com/alecthomas/chroma"
)
func TestClosestColour(t *testing.T) {
actual := findClosest(ttyTables[256], chroma.MustParseColour("#e06c75"))
assert.Equal(t, chroma.MustParseColour("#d75f87"), actual)
}