color/LCH_test.go
2024-03-12 15:23:08 +01:00

50 lines
1019 B
Go

package color_test
import (
"fmt"
"testing"
"git.akyoto.dev/go/color"
)
func TestLCH(t *testing.T) {
color.Terminal = true
lchColors := map[string]color.Color{
"black": color.LCH(0.0, 0.0, 0),
"white": color.LCH(1.0, 0.0, 0),
"gray": color.LCH(0.5, 0.0, 0),
"pink": color.LCH(0.75, 1.0, 0),
"red": color.LCH(0.75, 1.0, 40),
"orange": color.LCH(0.75, 1.0, 60),
"yellow": color.LCH(0.9, 1.0, 100),
"green": color.LCH(0.75, 1.0, 135),
"blue": color.LCH(0.75, 1.0, 260),
"cyan": color.LCH(0.75, 1.0, 210),
"magenta": color.LCH(0.75, 1.0, 320),
}
for name, c := range lchColors {
testColorRange(t, c)
c.Println("█ " + name)
}
}
func TestLCHSpectrum(t *testing.T) {
color.Terminal = true
for chroma := range 4 {
for lightness := range 21 {
for hue := range 80 {
c := color.LCH(color.Value(lightness)*0.05, color.Value(chroma)*0.05, color.Value(hue)*4.4)
testColorRange(t, c)
c.Print("█")
}
fmt.Println()
}
fmt.Println()
}
}