Files
new-server/models/colorhs.go
T
gisle df865574bf
continuous-integration/drone/push Build is passing
rework color system and make it work with drivers.
2022-02-21 19:27:42 +01:00

18 lines
329 B
Go

package models
import "github.com/lucasb-eyer/go-colorful"
type ColorHS struct {
Hue float64 `json:"hue"`
Sat float64 `json:"sat"`
}
func (hs ColorHS) ToXY() ColorXY {
return hs.ToRGB().ToXY()
}
func (hs ColorHS) ToRGB() ColorRGB {
c := colorful.Hsv(hs.Hue, hs.Sat, 1)
return ColorRGB{Red: c.R, Green: c.G, Blue: c.B}
}