zntg/ui/style.go

94 lines
2.3 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
// 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
// ShadedBackground is a darker version of the background color.
ShadedBackground color.Color
// Text is the default text color.
Text color.Color
// TextDisabled is disabled text color.
TextDisabled color.Color
// TextNegative is the text color associated with a negative event.
TextNegative color.Color
// TextOnPrimary is the text color when used with the main contrast color as background.
TextOnPrimary 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{
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`),
}
}
func DefaultStyle() *Style {
return &Style{
Dimensions: DefaultDimensions(),
Fonts: DefaultFontNames(),
Palette: DefaultPalette(),
}
}