diff --git a/styles/utils.go b/styles/utils.go index 82b9e8a..47edd0f 100644 --- a/styles/utils.go +++ b/styles/utils.go @@ -134,9 +134,9 @@ func HSL(hue, saturation, lightness int) string { builder.WriteString("hsl(") builder.WriteString(strconv.FormatInt(int64(hue), 10)) builder.WriteString(",") - builder.WriteString(strconv.FormatInt(int64(hue), 10)) + builder.WriteString(strconv.FormatInt(int64(saturation), 10)) builder.WriteString("%,") - builder.WriteString(strconv.FormatInt(int64(hue), 10)) + builder.WriteString(strconv.FormatInt(int64(lightness), 10)) builder.WriteString("%") builder.WriteString(")") return builder.String() @@ -147,9 +147,9 @@ func HSLA(hue, saturation, lightness int, alpha float64) string { builder.WriteString("hsla(") builder.WriteString(strconv.FormatInt(int64(hue), 10)) builder.WriteString(",") - builder.WriteString(strconv.FormatInt(int64(hue), 10)) + builder.WriteString(strconv.FormatInt(int64(saturation), 10)) builder.WriteString("%,") - builder.WriteString(strconv.FormatInt(int64(hue), 10)) + builder.WriteString(strconv.FormatInt(int64(lightness), 10)) builder.WriteString("%,") builder.WriteString(strconv.FormatFloat(alpha, 'f', 2, 64)) builder.WriteString(")") diff --git a/styles/utils_test.go b/styles/utils_test.go index 081348a..8be15b8 100644 --- a/styles/utils_test.go +++ b/styles/utils_test.go @@ -168,16 +168,16 @@ func TestMilliseconds(t *testing.T) { } func TestHSL(t *testing.T) { - assert.Equal(t, "hsl(100,100%,100%)", HSL(100, 100, 100)) + assert.Equal(t, "hsl(100,50%,25%)", HSL(100, 50, 25)) assert.Equal(t, "hsl(0,0%,0%)", HSL(0, 0, 0)) - assert.Equal(t, "hsl(50,50%,50%)", HSL(50, 50, 50)) - assert.Equal(t, "hsl(25,25%,25%)", HSL(25, 25, 25)) + assert.Equal(t, "hsl(50,70%,80%)", HSL(50, 70, 80)) + assert.Equal(t, "hsl(20,40%,60%)", HSL(20, 40, 60)) } func TestHSLA(t *testing.T) { - assert.Equal(t, "hsla(100,100%,100%,1.00)", HSLA(100, 100, 100, 1)) + assert.Equal(t, "hsla(90,50%,30%,1.00)", HSLA(90, 50, 30, 1)) assert.Equal(t, "hsla(0,0%,0%,0.10)", HSLA(0, 0, 0, 0.1)) - assert.Equal(t, "hsla(50,50%,50%,0.50)", HSLA(50, 50, 50, 0.5000)) - assert.Equal(t, "hsla(25,25%,25%,0.25)", HSLA(25, 25, 25, 0.2500)) - assert.Equal(t, "hsla(25,25%,25%,0.00)", HSLA(25, 25, 25, 0)) + assert.Equal(t, "hsla(50,60%,70%,0.50)", HSLA(50, 60, 70, 0.5000)) + assert.Equal(t, "hsla(25,35%,45%,0.25)", HSLA(25, 35, 45, 0.2500)) + assert.Equal(t, "hsla(20,50%,80%,0.00)", HSLA(20, 50, 80, 0)) }