2019-03-05 20:52:18 +00:00
|
|
|
package ui
|
|
|
|
|
2020-05-15 13:42:24 +00:00
|
|
|
import (
|
|
|
|
"image/color"
|
|
|
|
|
|
|
|
"opslag.de/schobers/zntg"
|
|
|
|
)
|
2019-03-05 20:52:18 +00:00
|
|
|
|
|
|
|
var defaultDimensions *Dimensions
|
|
|
|
var defaultFonts *Fonts
|
|
|
|
var defaultPalette *Palette
|
|
|
|
var defaultStyle *Style
|
|
|
|
|
|
|
|
type Dimensions struct {
|
2019-04-11 21:27:25 +00:00
|
|
|
OutlineWidth float32
|
2019-03-05 20:52:18 +00:00
|
|
|
ScrollbarWidth float32
|
|
|
|
TextPadding float32
|
|
|
|
}
|
|
|
|
|
2020-05-15 13:42:24 +00:00
|
|
|
type FontNames struct {
|
2019-03-05 20:52:18 +00:00
|
|
|
Default string
|
2020-05-15 14:39:53 +00:00
|
|
|
Tooltip string
|
2019-03-05 20:52:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2019-06-24 18:57:58 +00:00
|
|
|
// TextNegative is the text color associated with a negative event.
|
|
|
|
TextNegative color.Color
|
2019-03-12 18:50:34 +00:00
|
|
|
// TextOnPrimary is the text color when used with the main contrast color as background.
|
|
|
|
TextOnPrimary color.Color
|
2019-06-24 18:57:58 +00:00
|
|
|
// TextPositive is the text color associated with a positive event.
|
|
|
|
TextPositive color.Color
|
2019-03-05 20:52:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Style struct {
|
|
|
|
Dimensions *Dimensions
|
2020-05-15 13:42:24 +00:00
|
|
|
Fonts *FontNames
|
2019-03-05 20:52:18 +00:00
|
|
|
Palette *Palette
|
|
|
|
}
|
|
|
|
|
|
|
|
func DefaultDimensions() *Dimensions {
|
2020-05-15 13:42:24 +00:00
|
|
|
return &Dimensions{
|
|
|
|
OutlineWidth: 2.,
|
|
|
|
ScrollbarWidth: 16.,
|
|
|
|
TextPadding: 8.,
|
2019-03-05 20:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-15 13:42:24 +00:00
|
|
|
func DefaultFontNames() *FontNames {
|
|
|
|
return &FontNames{
|
|
|
|
Default: "default",
|
2020-05-15 14:39:53 +00:00
|
|
|
Tooltip: "default",
|
2019-03-05 20:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func DefaultPalette() *Palette {
|
2020-05-15 13:42:24 +00:00
|
|
|
return &Palette{
|
|
|
|
Background: color.White,
|
|
|
|
Primary: zntg.MustHexColor(`#3F51B5`),
|
|
|
|
PrimaryDark: zntg.MustHexColor(`#002884`),
|
|
|
|
PrimaryHighlight: zntg.MustHexColor(`#E8EAF6`),
|
|
|
|
PrimaryLight: zntg.MustHexColor(`#757CE8`),
|
|
|
|
ShadedBackground: zntg.MustHexColor(`#FAFAFA`),
|
|
|
|
Text: color.Black,
|
|
|
|
TextDisabled: zntg.MustHexColor(`#BDBDBD`),
|
|
|
|
TextNegative: zntg.MustHexColor(`#FF4336`),
|
|
|
|
TextOnPrimary: color.White,
|
|
|
|
TextPositive: zntg.MustHexColor(`#4CAF50`),
|
2019-03-05 20:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func DefaultStyle() *Style {
|
2020-05-15 13:42:24 +00:00
|
|
|
return &Style{
|
|
|
|
Dimensions: DefaultDimensions(),
|
|
|
|
Fonts: DefaultFontNames(),
|
|
|
|
Palette: DefaultPalette(),
|
2019-03-05 20:52:18 +00:00
|
|
|
}
|
|
|
|
}
|