2018-08-03 06:46:10 +00:00
|
|
|
package ui
|
|
|
|
|
|
|
|
import (
|
|
|
|
"image/color"
|
|
|
|
|
|
|
|
"opslag.de/schobers/galleg/allegro5"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Palette interface {
|
|
|
|
Primary() allegro5.Color
|
2018-09-09 16:49:18 +00:00
|
|
|
PrimaryHighlight() allegro5.Color
|
2018-08-07 05:03:52 +00:00
|
|
|
PrimaryTransparent() allegro5.Color
|
|
|
|
Lightest() allegro5.Color
|
|
|
|
Darker() allegro5.Color
|
|
|
|
Darkest() allegro5.Color
|
2018-08-03 06:46:10 +00:00
|
|
|
Disabled() allegro5.Color
|
|
|
|
}
|
|
|
|
|
|
|
|
type palette struct {
|
|
|
|
primary allegro5.Color
|
2018-09-09 16:49:18 +00:00
|
|
|
primaryH allegro5.Color
|
2018-08-07 05:03:52 +00:00
|
|
|
primaryT allegro5.Color
|
|
|
|
lightest allegro5.Color
|
|
|
|
darker allegro5.Color
|
|
|
|
darkest allegro5.Color
|
2018-08-03 06:46:10 +00:00
|
|
|
disabled allegro5.Color
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *palette) Primary() allegro5.Color {
|
|
|
|
return p.primary
|
|
|
|
}
|
2018-08-07 05:03:52 +00:00
|
|
|
|
2018-09-09 16:49:18 +00:00
|
|
|
func (p *palette) PrimaryHighlight() allegro5.Color {
|
|
|
|
return p.primaryH
|
|
|
|
}
|
|
|
|
|
2018-08-07 05:03:52 +00:00
|
|
|
func (p *palette) PrimaryTransparent() allegro5.Color {
|
|
|
|
return p.primaryT
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *palette) Lightest() allegro5.Color {
|
|
|
|
return p.lightest
|
2018-08-03 06:46:10 +00:00
|
|
|
}
|
2018-08-07 05:03:52 +00:00
|
|
|
|
|
|
|
func (p *palette) Darker() allegro5.Color {
|
|
|
|
return p.darker
|
2018-08-03 06:46:10 +00:00
|
|
|
}
|
2018-08-07 05:03:52 +00:00
|
|
|
|
|
|
|
func (p *palette) Darkest() allegro5.Color {
|
|
|
|
return p.darkest
|
|
|
|
}
|
|
|
|
|
2018-08-03 06:46:10 +00:00
|
|
|
func (p *palette) Disabled() allegro5.Color {
|
|
|
|
return p.disabled
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewColor(c *color.RGBA) allegro5.Color {
|
|
|
|
return allegro5.NewColorAlpha(c.R, c.G, c.B, c.A)
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewColorAlpha(c *color.RGBA, a uint8) allegro5.Color {
|
|
|
|
return allegro5.NewColorAlpha(c.R, c.G, c.B, a)
|
|
|
|
}
|
|
|
|
|
|
|
|
func DefaultPalette() Palette {
|
2018-08-07 05:03:52 +00:00
|
|
|
var primary = Blue500
|
2018-08-03 06:46:10 +00:00
|
|
|
return &palette{
|
2018-08-07 05:03:52 +00:00
|
|
|
primary: NewColor(primary),
|
2018-09-09 16:49:18 +00:00
|
|
|
primaryH: NewColor(Blue400),
|
2018-08-07 05:03:52 +00:00
|
|
|
primaryT: NewColorAlpha(primary, 96),
|
|
|
|
lightest: allegro5.NewColor(0xff, 0xff, 0xff),
|
|
|
|
darker: allegro5.NewColorAlpha(0, 0, 0, 188),
|
|
|
|
darkest: allegro5.NewColorAlpha(0, 0, 0, 222),
|
2018-08-03 06:46:10 +00:00
|
|
|
disabled: allegro5.NewColorAlpha(0x1f, 0x1f, 0x1f, 0x1f),
|
|
|
|
}
|
|
|
|
}
|