zntg/ui/style.go

116 lines
3.2 KiB
Go
Raw Normal View History

package ui
import (
"image/color"
"opslag.de/schobers/zntg"
)
var defaultDimensions *Dimensions
var defaultFonts *Fonts
var defaultPalette *Palette
var defaultStyle *Style
type Dimensions struct {
OutlineWidth float32
ScrollbarWidth float32
TextPadding float32
}
type FontNames struct {
Default string
2020-05-15 14:39:53 +00:00
Tooltip string
}
type Palette struct {
// Background is the default background color.
Background color.Color
2020-05-16 11:46:07 +00:00
// Disabled is the color to use when the control is disabled.
Disabled color.Color
// Primary is used as a the main contrast color.
Primary color.Color
// PrimaryDark is a foreground version of the main contrast color.
PrimaryDark color.Color
// PrimaryHighlight is a light version of the main contrast color.
PrimaryHighlight color.Color
// PrimaryLight is a background version of the main contrast color.
PrimaryLight color.Color
2020-05-15 15:02:18 +00:00
// Secondary is used as a the secondary contrast color.
Secondary color.Color
// SecondaryDark is a foreground version of the secondary contrast color.
SecondaryDark color.Color
// SecondaryHighlight is a light version of the secondary contrast color.
SecondaryHighlight color.Color
// SecondaryLight is a background version of the secondary contrast color.
SecondaryLight color.Color
// ShadedBackground is a darker version of the background color.
ShadedBackground color.Color
// Text is the default text color.
Text color.Color
// TextNegative is the text color associated with a negative event.
TextNegative color.Color
2020-05-16 11:46:07 +00:00
// TextOnDisabled is text color rendered over an disabled control.
TextOnDisabled color.Color
// TextOnPrimary is the text color when used with the main contrast color as background.
TextOnPrimary color.Color
2020-05-15 15:02:18 +00:00
// TextOnSecondary is the text color when used with the secondary contrast color as background.
TextOnSecondary color.Color
// TextPositive is the text color associated with a positive event.
TextPositive color.Color
}
type Style struct {
Dimensions *Dimensions
Fonts *FontNames
Palette *Palette
}
func DefaultDimensions() *Dimensions {
return &Dimensions{
OutlineWidth: 2.,
ScrollbarWidth: 16.,
TextPadding: 8.,
}
}
func DefaultFontNames() *FontNames {
return &FontNames{
Default: "default",
2020-05-15 14:39:53 +00:00
Tooltip: "default",
}
}
func DefaultPalette() *Palette {
return &Palette{
2020-05-15 15:02:18 +00:00
Background: color.White,
2020-05-16 11:46:07 +00:00
Disabled: zntg.MustHexColor(`#BDBDBD`),
2020-05-15 15:02:18 +00:00
Primary: zntg.MustHexColor(`#3F51B5`),
2020-05-15 15:02:18 +00:00
PrimaryDark: zntg.MustHexColor(`#132584`),
PrimaryHighlight: zntg.MustHexColor(`#E8EAF6`),
2020-05-15 15:02:18 +00:00
PrimaryLight: zntg.MustHexColor(`#5E6EC7`),
Secondary: zntg.MustHexColor(`#FFA441`),
SecondaryDark: zntg.MustHexColor(`#C06605`),
SecondaryHighlight: zntg.MustHexColor(`#FFEFDD`),
SecondaryLight: zntg.MustHexColor(`#FFB564`),
ShadedBackground: zntg.MustHexColor(`#FAFAFA`),
2020-05-15 15:02:18 +00:00
Text: color.Black,
TextNegative: zntg.MustHexColor(`#FF4336`),
2020-05-16 11:46:07 +00:00
TextOnDisabled: zntg.MustHexColor(`#5C5C5C`),
2020-05-15 15:02:18 +00:00
TextOnPrimary: color.White,
TextOnSecondary: color.Black,
TextPositive: zntg.MustHexColor(`#4CAF50`),
}
}
func DefaultStyle() *Style {
return &Style{
Dimensions: DefaultDimensions(),
Fonts: DefaultFontNames(),
Palette: DefaultPalette(),
}
}