2019-03-05 20:52:18 +00:00
|
|
|
package ui
|
|
|
|
|
|
|
|
import "image/color"
|
|
|
|
|
|
|
|
var defaultDimensions *Dimensions
|
|
|
|
var defaultFonts *Fonts
|
|
|
|
var defaultPalette *Palette
|
|
|
|
var defaultStyle *Style
|
|
|
|
|
|
|
|
type Dimensions struct {
|
|
|
|
ScrollbarWidth float32
|
|
|
|
TextPadding float32
|
|
|
|
}
|
|
|
|
|
|
|
|
type Fonts struct {
|
|
|
|
Default string
|
|
|
|
}
|
|
|
|
|
|
|
|
type Palette struct {
|
2019-03-12 18:50:34 +00:00
|
|
|
// Background is the default background color.
|
|
|
|
Background color.Color
|
|
|
|
// Primary is used as a the main contrast color.
|
|
|
|
Primary color.Color
|
2019-04-11 18:02:15 +00:00
|
|
|
// PrimaryDark is a foreground version of the main contrast color.
|
|
|
|
PrimaryDark color.Color
|
|
|
|
// PrimaryHighlight is a light version of the main contrast color.
|
2019-03-05 20:52:18 +00:00
|
|
|
PrimaryHighlight color.Color
|
2019-03-13 18:49:00 +00:00
|
|
|
// PrimaryLight is a background version of the main contrast color.
|
|
|
|
PrimaryLight color.Color
|
2019-03-12 18:50:34 +00:00
|
|
|
// ShadedBackground is a darker version of the background color.
|
2019-03-05 20:52:18 +00:00
|
|
|
ShadedBackground color.Color
|
2019-03-12 18:50:34 +00:00
|
|
|
// Text is the default text color.
|
|
|
|
Text color.Color
|
|
|
|
// TextDisabled is disabled text color.
|
|
|
|
TextDisabled color.Color
|
|
|
|
// TextOnPrimary is the text color when used with the main contrast color as background.
|
|
|
|
TextOnPrimary color.Color
|
2019-03-05 20:52:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Style struct {
|
|
|
|
Dimensions *Dimensions
|
|
|
|
Fonts *Fonts
|
|
|
|
Palette *Palette
|
|
|
|
}
|
|
|
|
|
|
|
|
func DefaultDimensions() *Dimensions {
|
|
|
|
if defaultDimensions == nil {
|
|
|
|
defaultDimensions = &Dimensions{
|
|
|
|
ScrollbarWidth: 16.,
|
|
|
|
TextPadding: 8.,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return defaultDimensions
|
|
|
|
}
|
|
|
|
|
|
|
|
func DefaultFonts() *Fonts {
|
|
|
|
if defaultFonts == nil {
|
|
|
|
defaultFonts = &Fonts{
|
|
|
|
Default: "default",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return defaultFonts
|
|
|
|
}
|
|
|
|
|
|
|
|
func DefaultPalette() *Palette {
|
|
|
|
if defaultPalette == nil {
|
|
|
|
defaultPalette = &Palette{
|
2019-03-13 18:49:00 +00:00
|
|
|
Background: color.White,
|
|
|
|
Primary: RGBA(0x3F, 0x51, 0xB5, 0xFF),
|
2019-04-11 18:02:15 +00:00
|
|
|
PrimaryDark: RGBA(0x00, 0x28, 0x84, 0xFF),
|
|
|
|
PrimaryHighlight: RGBA(0xE8, 0xEA, 0xF6, 0xFF),
|
|
|
|
PrimaryLight: RGBA(0x75, 0x7C, 0xE8, 0xFF),
|
2019-03-13 18:49:00 +00:00
|
|
|
ShadedBackground: RGBA(0xFA, 0xFA, 0xFA, 0xFF),
|
|
|
|
Text: color.Black,
|
|
|
|
TextDisabled: RGBA(0xBD, 0xBD, 0xBD, 0xFF),
|
|
|
|
TextOnPrimary: color.White,
|
2019-03-05 20:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return defaultPalette
|
|
|
|
}
|
|
|
|
|
|
|
|
func DefaultStyle() *Style {
|
|
|
|
if defaultStyle == nil {
|
|
|
|
defaultStyle = &Style{
|
|
|
|
Dimensions: DefaultDimensions(),
|
|
|
|
Fonts: DefaultFonts(),
|
|
|
|
Palette: DefaultPalette(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return defaultStyle
|
|
|
|
}
|
|
|
|
|
|
|
|
func RGBA(r, g, b, a byte) *color.RGBA {
|
|
|
|
return &color.RGBA{R: r, G: g, B: b, A: a}
|
|
|
|
}
|