You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
329 B
17 lines
329 B
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}
|
|
}
|