Compare commits
No commits in common. "fe40294f52c87200e8935f6b1fd7c48ee5d9a7f8" and "77738836880f185c129ce3e493d1db776da9bc04" have entirely different histories.
fe40294f52
...
7773883688
98
color.go
98
color.go
@ -30,50 +30,40 @@ type (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
KelvinCandlelight = 1500
|
WhiteCandlelight = 1500
|
||||||
KelvinSunset = 2000
|
WhiteSunset = 2000
|
||||||
KelvinUltraWarm = 2500
|
WhiteUltraWarm = 2500
|
||||||
KelvinIncandescent = 2700
|
WhiteIncandescent = 2700
|
||||||
KelvinWarm = 3000
|
WhiteWarm = 3000
|
||||||
KelvinCool = 4000
|
WhiteCool = 4000
|
||||||
KelvinCoolDaylight = 4500
|
WhiteCoolDaylight = 4500
|
||||||
KelvinSoftDaylight = 5000
|
WhiteSoftDaylight = 5000
|
||||||
KelvinDaylight = 5600
|
WhiteDaylight = 5600
|
||||||
KelvinNoonDaylight = 6000
|
WhiteNoonDaylight = 6000
|
||||||
KelvinBrightDaylight = 6500
|
WhiteBrightDaylight = 6500
|
||||||
KelvinCloudDaylight = 7000
|
WhiteCloudDaylight = 7000
|
||||||
KelvinBlueDaylight = 7500
|
WhiteBlueDaylight = 7500
|
||||||
KelvinBlueOvercast = 8000
|
WhiteBlueOvercast = 8000
|
||||||
KelvinBlueIce = 9000
|
WhiteBlueIce = 9000
|
||||||
|
|
||||||
HueWhite = 0
|
|
||||||
HueRed = 0
|
|
||||||
HueOrange = 36
|
|
||||||
HueYellow = 60
|
|
||||||
HueGreen = 120
|
|
||||||
HueCyan = 180
|
|
||||||
HueBlue = 250
|
|
||||||
HuePurple = 280
|
|
||||||
HuePink = 325
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
DefaultWhites = map[string]int{
|
DefaultWhites = map[string]int{
|
||||||
"candlelight": KelvinCandlelight,
|
"candlelight": WhiteCandlelight,
|
||||||
"sunset": KelvinSunset,
|
"sunset": WhiteSunset,
|
||||||
"ultrawarm": KelvinUltraWarm,
|
"ultrawarm": WhiteUltraWarm,
|
||||||
"incandesent": KelvinIncandescent,
|
"incandesent": WhiteIncandescent,
|
||||||
"warm": KelvinWarm,
|
"warm": WhiteWarm,
|
||||||
"cool": KelvinCool,
|
"cool": WhiteCool,
|
||||||
"cooldaylight": KelvinCoolDaylight,
|
"cooldaylight": WhiteCoolDaylight,
|
||||||
"softdaylight": KelvinSoftDaylight,
|
"softdaylight": WhiteSoftDaylight,
|
||||||
"daylight": KelvinDaylight,
|
"daylight": WhiteDaylight,
|
||||||
"noondaylight": KelvinNoonDaylight,
|
"noondaylight": WhiteNoonDaylight,
|
||||||
"brightdaylight": KelvinBrightDaylight,
|
"brightdaylight": WhiteBrightDaylight,
|
||||||
"clouddaylight": KelvinCloudDaylight,
|
"clouddaylight": WhiteCloudDaylight,
|
||||||
"bluedaylight": KelvinBlueDaylight,
|
"bluedaylight": WhiteBlueDaylight,
|
||||||
"blueovercast": KelvinBlueOvercast,
|
"blueovercast": WhiteBlueOvercast,
|
||||||
"blueice": KelvinBlueIce,
|
"blueice": WhiteBlueIce,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -81,24 +71,6 @@ func NewRGBColor(r, g, b uint8) (*RGBColor, error) {
|
|||||||
return &RGBColor{R: r, G: g, B: b}, nil
|
return &RGBColor{R: r, G: g, B: b}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHSColor(h, s float32) (HSBKColor, error) {
|
|
||||||
var c HSBKColor
|
|
||||||
|
|
||||||
if h < 0 || h > 360 {
|
|
||||||
return c, errors.New("hue must be between 0.0-360.0")
|
|
||||||
}
|
|
||||||
if s < 0 || s > 1 {
|
|
||||||
return c, errors.New("saturation must be between 0.0-1.0")
|
|
||||||
}
|
|
||||||
|
|
||||||
c = HSBKColor{
|
|
||||||
H: Float32Ptr(h),
|
|
||||||
S: Float32Ptr(s),
|
|
||||||
}
|
|
||||||
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewHSBColor(h, s, b float32) (HSBKColor, error) {
|
func NewHSBColor(h, s, b float32) (HSBKColor, error) {
|
||||||
var c HSBKColor
|
var c HSBKColor
|
||||||
|
|
||||||
@ -121,14 +93,6 @@ func NewHSBColor(h, s, b float32) (HSBKColor, error) {
|
|||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRed() (HSBKColor, error) { return NewHSColor(HueRed, 1) }
|
|
||||||
func NewOrange() (HSBKColor, error) { return NewHSColor(HueOrange, 1) }
|
|
||||||
func NewYellow() (HSBKColor, error) { return NewHSColor(HueYellow, 1) }
|
|
||||||
func NewGreen() (HSBKColor, error) { return NewHSColor(HueGreen, 1) }
|
|
||||||
func NewCyan() (HSBKColor, error) { return NewHSColor(HueCyan, 1) }
|
|
||||||
func NewPurple() (HSBKColor, error) { return NewHSColor(HuePurple, 1) }
|
|
||||||
func NewPink() (HSBKColor, error) { return NewHSColor(HuePink, 1) }
|
|
||||||
|
|
||||||
func NewWhite(k int16) (HSBKColor, error) {
|
func NewWhite(k int16) (HSBKColor, error) {
|
||||||
var c HSBKColor
|
var c HSBKColor
|
||||||
|
|
||||||
@ -137,7 +101,7 @@ func NewWhite(k int16) (HSBKColor, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c = HSBKColor{
|
c = HSBKColor{
|
||||||
H: Float32Ptr(HueWhite),
|
H: Float32Ptr(0.0),
|
||||||
S: Float32Ptr(0.0),
|
S: Float32Ptr(0.0),
|
||||||
K: Int16Ptr(k),
|
K: Int16Ptr(k),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user