310 lines
7.2 KiB
Go
310 lines
7.2 KiB
Go
package fallbackStyle
|
|
|
|
import "image/color"
|
|
import "git.tebibyte.media/tomo/tomo"
|
|
import "golang.org/x/image/font/basicfont"
|
|
import dataTheme "git.tebibyte.media/tomo/nasin/internal/theme"
|
|
|
|
var colorFocus = color.RGBA { R: 61, G: 128, B: 143, A: 255 }
|
|
var colorInput = color.RGBA { R: 208, G: 203, B: 150, A: 255 }
|
|
var colorCarved = color.RGBA { R: 151, G: 160, B: 150, A: 255 }
|
|
var colorGutter = color.RGBA { R: 116, G: 132, B: 126, A: 255 }
|
|
var colorShadow = color.RGBA { R: 57, G: 59, B: 57, A: 255 }
|
|
var colorInputShadow = color.RGBA { R: 143, G: 146, B: 91, A: 255 }
|
|
var colorHighlight = color.RGBA { R: 207, G: 215, B: 210, A: 255 }
|
|
var colorBackground = color.RGBA { R: 169, G: 171, B: 168, A: 255 }
|
|
var colorCarvedPressed = color.RGBA { R: 129, G: 142, B: 137, A: 255 }
|
|
var colorForeground = color.Black
|
|
var colorOutline = color.Black
|
|
|
|
var outline = tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: [4]color.Color {
|
|
colorOutline,
|
|
colorOutline,
|
|
colorOutline,
|
|
colorOutline,
|
|
},
|
|
}
|
|
|
|
var borderColorEngraved = [4]color.Color { colorShadow, colorHighlight, colorHighlight, colorShadow }
|
|
var borderColorLifted = [4]color.Color { colorHighlight, colorShadow, colorShadow, colorHighlight }
|
|
var borderColorInput = [4]color.Color { colorInputShadow, colorInput, colorInput, colorInputShadow }
|
|
var borderColorFocused = [4]color.Color { colorFocus, colorFocus, colorFocus, colorFocus }
|
|
|
|
var rules = []dataTheme.Rule {
|
|
// *.*[*]
|
|
dataTheme.Rule {
|
|
Default: dataTheme.AS (
|
|
dataTheme.AttrFace { Face: basicfont.Face7x13 },
|
|
dataTheme.AttrTextColor { Color: tomo.ColorForeground },
|
|
dataTheme.AttrDotColor { Color: tomo.ColorAccent },
|
|
dataTheme.AttrGap { X: 8, Y: 8 },
|
|
),
|
|
},
|
|
|
|
// *.Button[*]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "Button", ""),
|
|
Default: dataTheme.AS (
|
|
dataTheme.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorLifted,
|
|
},
|
|
},
|
|
dataTheme.AttrPadding(tomo.I(4, 8)),
|
|
dataTheme.AttrColor { Color: tomo.ColorRaised },
|
|
),
|
|
Pressed: dataTheme.AS (
|
|
dataTheme.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
Color: borderColorEngraved,
|
|
},
|
|
},
|
|
dataTheme.AttrPadding(tomo.I(5, 8, 4, 9)),
|
|
dataTheme.AttrColor { Color: colorCarvedPressed },
|
|
),
|
|
Focused: dataTheme.AS (
|
|
dataTheme.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorFocused,
|
|
},
|
|
},
|
|
dataTheme.AttrPadding(tomo.I(4, 8)),
|
|
),
|
|
},
|
|
|
|
// *.TextInput[*]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "TextInput", ""),
|
|
Default: dataTheme.AS (
|
|
dataTheme.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorInput,
|
|
},
|
|
},
|
|
dataTheme.AttrColor { Color: colorInput },
|
|
dataTheme.AttrPadding(tomo.I(5, 4, 4, 5)),
|
|
),
|
|
Focused: dataTheme.AS (
|
|
dataTheme.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorFocused,
|
|
},
|
|
},
|
|
),
|
|
},
|
|
|
|
// *.TextView[*]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "TextView", ""),
|
|
Default: dataTheme.AS (
|
|
dataTheme.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
Color: borderColorEngraved,
|
|
},
|
|
},
|
|
dataTheme.AttrColor { Color: tomo.ColorSunken },
|
|
dataTheme.AttrPadding(tomo.I(8)),
|
|
),
|
|
},
|
|
|
|
// *.NumberInput[*]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "NumberInput", ""),
|
|
Default: dataTheme.AS (
|
|
dataTheme.AttrGap { },
|
|
),
|
|
},
|
|
|
|
// *.Container[sunken]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "Container", "sunken"),
|
|
Default: dataTheme.AS (
|
|
dataTheme.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
Color: borderColorEngraved,
|
|
},
|
|
},
|
|
dataTheme.AttrColor { Color: tomo.ColorSunken },
|
|
dataTheme.AttrPadding(tomo.I(8)),
|
|
),
|
|
},
|
|
|
|
// *.Container[outer]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "Container", "outer"),
|
|
Default: dataTheme.AS (
|
|
dataTheme.AttrColor { Color: tomo.ColorBackground },
|
|
dataTheme.AttrPadding(tomo.I(8)),
|
|
),
|
|
},
|
|
|
|
// *.Container[menu]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "Container", "menu"),
|
|
Default: dataTheme.AS (
|
|
dataTheme.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorLifted,
|
|
},
|
|
},
|
|
dataTheme.AttrColor { Color: tomo.ColorBackground },
|
|
dataTheme.AttrGap { },
|
|
),
|
|
},
|
|
|
|
// *.Heading[*]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "Heading", ""),
|
|
Default: dataTheme.AS (
|
|
dataTheme.AttrAlign { X: tomo.AlignMiddle, Y: tomo.AlignMiddle },
|
|
),
|
|
},
|
|
|
|
// *.Separator[*]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "Separator", ""),
|
|
Default: dataTheme.AS (
|
|
dataTheme.AttrBorder {
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorEngraved,
|
|
},
|
|
},
|
|
),
|
|
},
|
|
|
|
// *.Slider[*]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "Slider", ""),
|
|
Default: dataTheme.AS (
|
|
dataTheme.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
Color: borderColorEngraved,
|
|
},
|
|
},
|
|
dataTheme.AttrColor { Color: colorGutter },
|
|
dataTheme.AttrPadding(tomo.I(0, 1, 1, 0)),
|
|
),
|
|
Focused: dataTheme.AS (
|
|
dataTheme.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorFocused,
|
|
},
|
|
},
|
|
dataTheme.AttrPadding(tomo.I(0)),
|
|
),
|
|
},
|
|
|
|
// *.Slider[horizontal]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "Slider", "horizontal"),
|
|
Default: dataTheme.AS(dataTheme.AttrMinimumSize { X: 48 }),
|
|
},
|
|
|
|
// *.Slider[vertical]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "Slider", "vertical"),
|
|
Default: dataTheme.AS(dataTheme.AttrMinimumSize { Y: 48 }),
|
|
},
|
|
|
|
// *.SliderHandle[*]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "SliderHandle", ""),
|
|
Default: dataTheme.AS (
|
|
dataTheme.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorLifted,
|
|
},
|
|
},
|
|
dataTheme.AttrColor { Color: tomo.ColorRaised },
|
|
dataTheme.AttrMinimumSize { X: 12, Y: 12, },
|
|
),
|
|
},
|
|
|
|
// *.Checkbox[*]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "Checkbox", ""),
|
|
Default: dataTheme.AS (
|
|
dataTheme.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
Color: borderColorEngraved,
|
|
},
|
|
},
|
|
dataTheme.AttrColor { Color: tomo.ColorSunken },
|
|
dataTheme.AttrPadding(tomo.I(0, 1, 1, 0)),
|
|
dataTheme.AttrMinimumSize { X: 19, Y: 19 },
|
|
),
|
|
Focused: dataTheme.AS (
|
|
dataTheme.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorFocused,
|
|
},
|
|
},
|
|
dataTheme.AttrPadding(tomo.I(0)),
|
|
),
|
|
},
|
|
|
|
// *.LabelCheckbox[*]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "LabelCheckbox", ""),
|
|
Default: dataTheme.AS (
|
|
dataTheme.AttrGap { X: 8, Y: 8 },
|
|
),
|
|
},
|
|
|
|
// *.MenuItem[*]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "MenuItem", ""),
|
|
Default: dataTheme.AS (
|
|
dataTheme.AttrPadding(tomo.I(4)),
|
|
dataTheme.AttrGap { X: 4, Y: 4 },
|
|
dataTheme.AttrColor { Color: color.Transparent },
|
|
),
|
|
Hovered: dataTheme.AS (
|
|
dataTheme.AttrColor { Color: tomo.ColorAccent },
|
|
),
|
|
Focused: dataTheme.AS (
|
|
dataTheme.AttrColor { Color: tomo.ColorAccent },
|
|
),
|
|
},
|
|
|
|
// *.File[*]
|
|
dataTheme.Rule {
|
|
Role: tomo.R("", "File", ""),
|
|
Default: dataTheme.AS (
|
|
dataTheme.AttrColor { Color: color.Transparent },
|
|
),
|
|
Focused: dataTheme.AS (
|
|
dataTheme.AttrColor { Color: tomo.ColorAccent },
|
|
),
|
|
},
|
|
}
|