continuous-integration/drone/push Build is passing
commit62e7cb88f4Author: Gisle Aune <dev@gisle.me> Date: Mon Feb 28 22:52:06 2022 +0100 refactor color system to be separate from models, also move errors out of models. commitdf865574bfAuthor: Gisle Aune <dev@gisle.me> Date: Mon Feb 21 19:27:42 2022 +0100 rework color system and make it work with drivers.
18 lines
310 B
Go
18 lines
310 B
Go
package color
|
|
|
|
import "github.com/lucasb-eyer/go-colorful"
|
|
|
|
type HueSat struct {
|
|
Hue float64 `json:"hue"`
|
|
Sat float64 `json:"sat"`
|
|
}
|
|
|
|
func (hs HueSat) ToXY() XY {
|
|
return hs.ToRGB().ToXY()
|
|
}
|
|
|
|
func (hs HueSat) ToRGB() RGB {
|
|
c := colorful.Hsv(hs.Hue, hs.Sat, 1)
|
|
return RGB{Red: c.R, Green: c.G, Blue: c.B}
|
|
}
|