Added HSL and HSV colors

This commit is contained in:
2025-03-11 14:24:41 +01:00
parent 1b0b4cb28f
commit f75ff8da5a
14 changed files with 153 additions and 48 deletions

View File

@ -3,12 +3,12 @@ package color_test
import (
"testing"
"git.urbach.dev/go/assert"
"git.urbach.dev/go/color"
)
func TestRGB(t *testing.T) {
color.Terminal = true
color.TrueColor = true
rgbColors := map[string]color.Color{
"black": color.RGB(0, 0, 0),
@ -24,17 +24,6 @@ func TestRGB(t *testing.T) {
}
for name, c := range rgbColors {
testColorRange(t, c)
c.Println("█ " + name)
}
}
func testColorRange(t *testing.T, c color.Color) {
assert.True(t, c.R >= 0.0)
assert.True(t, c.G >= 0.0)
assert.True(t, c.B >= 0.0)
assert.True(t, c.R <= 1.0)
assert.True(t, c.G <= 1.0)
assert.True(t, c.B <= 1.0)
}