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

8
RGB.go
View File

@ -2,9 +2,13 @@ package color
import "math"
// RGB creates a new color with red, green and blue values in the range of 0.0 to 1.0.
// RGB creates a new sRGB color.
func RGB(r Value, g Value, b Value) Color {
return Color{r, g, b}
return Color{
byte(sRGB(r) * 255),
byte(sRGB(g) * 255),
byte(sRGB(b) * 255),
}
}
// inSRGB indicates whether the given color can be mapped to the sRGB color space.