2018-08-03 06:46:10 +00:00
|
|
|
package ui
|
|
|
|
|
|
|
|
import (
|
|
|
|
"image/color"
|
|
|
|
|
2018-09-22 14:23:26 +00:00
|
|
|
"opslag.de/schobers/zntg/allg5"
|
2018-08-03 06:46:10 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Palette interface {
|
2018-09-22 14:23:26 +00:00
|
|
|
Primary() allg5.Color
|
|
|
|
PrimaryHighlight() allg5.Color
|
|
|
|
PrimaryTransparent() allg5.Color
|
|
|
|
Lightest() allg5.Color
|
|
|
|
Darker() allg5.Color
|
|
|
|
Darkest() allg5.Color
|
|
|
|
Disabled() allg5.Color
|
2018-08-03 06:46:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type palette struct {
|
2018-09-22 14:23:26 +00:00
|
|
|
primary allg5.Color
|
|
|
|
primaryH allg5.Color
|
|
|
|
primaryT allg5.Color
|
|
|
|
lightest allg5.Color
|
|
|
|
darker allg5.Color
|
|
|
|
darkest allg5.Color
|
|
|
|
disabled allg5.Color
|
2018-08-03 06:46:10 +00:00
|
|
|
}
|
|
|
|
|
2018-09-22 14:23:26 +00:00
|
|
|
func (p *palette) Primary() allg5.Color {
|
2018-08-03 06:46:10 +00:00
|
|
|
return p.primary
|
|
|
|
}
|
2018-08-07 05:03:52 +00:00
|
|
|
|
2018-09-22 14:23:26 +00:00
|
|
|
func (p *palette) PrimaryHighlight() allg5.Color {
|
2018-09-09 16:49:18 +00:00
|
|
|
return p.primaryH
|
|
|
|
}
|
|
|
|
|
2018-09-22 14:23:26 +00:00
|
|
|
func (p *palette) PrimaryTransparent() allg5.Color {
|
2018-08-07 05:03:52 +00:00
|
|
|
return p.primaryT
|
|
|
|
}
|
|
|
|
|
2018-09-22 14:23:26 +00:00
|
|
|
func (p *palette) Lightest() allg5.Color {
|
2018-08-07 05:03:52 +00:00
|
|
|
return p.lightest
|
2018-08-03 06:46:10 +00:00
|
|
|
}
|
2018-08-07 05:03:52 +00:00
|
|
|
|
2018-09-22 14:23:26 +00:00
|
|
|
func (p *palette) Darker() allg5.Color {
|
2018-08-07 05:03:52 +00:00
|
|
|
return p.darker
|
2018-08-03 06:46:10 +00:00
|
|
|
}
|
2018-08-07 05:03:52 +00:00
|
|
|
|
2018-09-22 14:23:26 +00:00
|
|
|
func (p *palette) Darkest() allg5.Color {
|
2018-08-07 05:03:52 +00:00
|
|
|
return p.darkest
|
|
|
|
}
|
|
|
|
|
2018-09-22 14:23:26 +00:00
|
|
|
func (p *palette) Disabled() allg5.Color {
|
2018-08-03 06:46:10 +00:00
|
|
|
return p.disabled
|
|
|
|
}
|
|
|
|
|
2018-09-22 14:23:26 +00:00
|
|
|
func NewColor(c *color.RGBA) allg5.Color {
|
|
|
|
return allg5.NewColorAlpha(c.R, c.G, c.B, c.A)
|
2018-08-03 06:46:10 +00:00
|
|
|
}
|
|
|
|
|
2018-09-22 14:23:26 +00:00
|
|
|
func NewColorAlpha(c *color.RGBA, a uint8) allg5.Color {
|
|
|
|
return allg5.NewColorAlpha(c.R, c.G, c.B, a)
|
2018-08-03 06:46:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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),
|
2018-09-22 14:23:26 +00:00
|
|
|
lightest: allg5.NewColor(0xff, 0xff, 0xff),
|
|
|
|
darker: allg5.NewColorAlpha(0, 0, 0, 188),
|
|
|
|
darkest: allg5.NewColorAlpha(0, 0, 0, 222),
|
|
|
|
disabled: allg5.NewColorAlpha(0x1f, 0x1f, 0x1f, 0x1f),
|
2018-08-03 06:46:10 +00:00
|
|
|
}
|
|
|
|
}
|