2024-06-03 07:04:29 +00:00
|
|
|
package fallbackStyle
|
2024-05-07 03:25:53 +00:00
|
|
|
|
|
|
|
import "image/color"
|
|
|
|
import "git.tebibyte.media/tomo/tomo"
|
|
|
|
import "golang.org/x/image/font/basicfont"
|
2024-06-12 04:19:12 +00:00
|
|
|
import "git.tebibyte.media/tomo/nasin/internal/style"
|
2024-05-07 03:25:53 +00:00
|
|
|
|
|
|
|
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 }
|
2024-05-13 23:55:57 +00:00
|
|
|
var colorGutter = color.RGBA { R: 116, G: 132, B: 126, A: 255 }
|
2024-05-07 03:25:53 +00:00
|
|
|
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 }
|
|
|
|
|
2024-06-12 04:19:12 +00:00
|
|
|
var rules = []style.Rule {
|
2024-05-07 03:25:53 +00:00
|
|
|
// *.*[*]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
|
|
|
Default: style.AS (
|
|
|
|
style.AttrFace { Face: basicfont.Face7x13 },
|
|
|
|
style.AttrTextColor { Color: tomo.ColorForeground },
|
|
|
|
style.AttrDotColor { Color: tomo.ColorAccent },
|
|
|
|
style.AttrGap { X: 8, Y: 8 },
|
2024-05-07 03:25:53 +00:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.Button[*]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-05-27 20:02:57 +00:00
|
|
|
Role: tomo.R("", "Button", ""),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-05-07 03:25:53 +00:00
|
|
|
outline,
|
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(1),
|
|
|
|
Color: borderColorLifted,
|
|
|
|
},
|
|
|
|
},
|
2024-06-12 04:19:12 +00:00
|
|
|
style.AttrPadding(tomo.I(4, 8)),
|
|
|
|
style.AttrColor { Color: tomo.ColorRaised },
|
2024-05-07 03:25:53 +00:00
|
|
|
),
|
2024-06-12 04:19:12 +00:00
|
|
|
Pressed: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-05-07 03:25:53 +00:00
|
|
|
outline,
|
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
|
|
Color: borderColorEngraved,
|
|
|
|
},
|
|
|
|
},
|
2024-06-12 04:19:12 +00:00
|
|
|
style.AttrPadding(tomo.I(5, 8, 4, 9)),
|
|
|
|
style.AttrColor { Color: colorCarvedPressed },
|
2024-05-07 03:25:53 +00:00
|
|
|
),
|
2024-06-12 04:19:12 +00:00
|
|
|
Focused: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-05-07 03:25:53 +00:00
|
|
|
outline,
|
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(1),
|
|
|
|
Color: borderColorFocused,
|
|
|
|
},
|
|
|
|
},
|
2024-06-12 04:19:12 +00:00
|
|
|
style.AttrPadding(tomo.I(4, 8)),
|
2024-05-07 03:25:53 +00:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.TextInput[*]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-05-27 20:02:57 +00:00
|
|
|
Role: tomo.R("", "TextInput", ""),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-05-07 03:25:53 +00:00
|
|
|
outline,
|
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(1),
|
|
|
|
Color: borderColorInput,
|
|
|
|
},
|
|
|
|
},
|
2024-06-12 04:19:12 +00:00
|
|
|
style.AttrColor { Color: colorInput },
|
|
|
|
style.AttrPadding(tomo.I(5, 4, 4, 5)),
|
2024-05-07 03:25:53 +00:00
|
|
|
),
|
2024-06-12 04:19:12 +00:00
|
|
|
Focused: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-05-07 03:25:53 +00:00
|
|
|
outline,
|
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(1),
|
|
|
|
Color: borderColorFocused,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
},
|
2024-05-18 18:29:57 +00:00
|
|
|
|
|
|
|
// *.TextView[*]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-05-27 20:02:57 +00:00
|
|
|
Role: tomo.R("", "TextView", ""),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-05-18 18:29:57 +00:00
|
|
|
outline,
|
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
|
|
Color: borderColorEngraved,
|
|
|
|
},
|
|
|
|
},
|
2024-06-12 04:19:12 +00:00
|
|
|
style.AttrColor { Color: tomo.ColorSunken },
|
|
|
|
style.AttrPadding(tomo.I(8)),
|
2024-05-18 18:29:57 +00:00
|
|
|
),
|
|
|
|
},
|
2024-05-07 03:25:53 +00:00
|
|
|
|
|
|
|
// *.NumberInput[*]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-05-27 20:02:57 +00:00
|
|
|
Role: tomo.R("", "NumberInput", ""),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrGap { },
|
2024-05-07 03:25:53 +00:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
2024-05-13 23:55:57 +00:00
|
|
|
// *.Container[sunken]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-05-27 20:02:57 +00:00
|
|
|
Role: tomo.R("", "Container", "sunken"),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-05-13 23:55:57 +00:00
|
|
|
outline,
|
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
|
|
Color: borderColorEngraved,
|
|
|
|
},
|
|
|
|
},
|
2024-06-12 04:19:12 +00:00
|
|
|
style.AttrColor { Color: tomo.ColorSunken },
|
|
|
|
style.AttrPadding(tomo.I(8)),
|
2024-05-13 23:55:57 +00:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
2024-05-07 03:25:53 +00:00
|
|
|
// *.Container[outer]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-05-27 20:02:57 +00:00
|
|
|
Role: tomo.R("", "Container", "outer"),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrColor { Color: tomo.ColorBackground },
|
|
|
|
style.AttrPadding(tomo.I(8)),
|
2024-05-07 03:25:53 +00:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
2024-05-29 01:57:48 +00:00
|
|
|
// *.Container[menu]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-05-29 01:57:48 +00:00
|
|
|
Role: tomo.R("", "Container", "menu"),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-05-29 01:57:48 +00:00
|
|
|
outline,
|
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(1),
|
|
|
|
Color: borderColorLifted,
|
|
|
|
},
|
|
|
|
},
|
2024-06-12 04:19:12 +00:00
|
|
|
style.AttrColor { Color: tomo.ColorBackground },
|
|
|
|
style.AttrGap { },
|
2024-05-29 01:57:48 +00:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
2024-05-07 03:25:53 +00:00
|
|
|
// *.Heading[*]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-05-27 20:02:57 +00:00
|
|
|
Role: tomo.R("", "Heading", ""),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrAlign { X: tomo.AlignMiddle, Y: tomo.AlignMiddle },
|
2024-05-07 03:25:53 +00:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.Separator[*]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-05-27 20:02:57 +00:00
|
|
|
Role: tomo.R("", "Separator", ""),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-05-07 03:25:53 +00:00
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(1),
|
|
|
|
Color: borderColorEngraved,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.Slider[*]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-05-27 20:02:57 +00:00
|
|
|
Role: tomo.R("", "Slider", ""),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-05-07 03:25:53 +00:00
|
|
|
outline,
|
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
|
|
Color: borderColorEngraved,
|
|
|
|
},
|
|
|
|
},
|
2024-06-12 04:19:12 +00:00
|
|
|
style.AttrColor { Color: colorGutter },
|
|
|
|
style.AttrPadding(tomo.I(0, 1, 1, 0)),
|
2024-05-07 03:25:53 +00:00
|
|
|
),
|
2024-06-12 04:19:12 +00:00
|
|
|
Focused: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-05-07 03:25:53 +00:00
|
|
|
outline,
|
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(1),
|
|
|
|
Color: borderColorFocused,
|
|
|
|
},
|
|
|
|
},
|
2024-06-12 04:19:12 +00:00
|
|
|
style.AttrPadding(tomo.I(0)),
|
2024-05-07 03:25:53 +00:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.Slider[horizontal]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-05-27 20:02:57 +00:00
|
|
|
Role: tomo.R("", "Slider", "horizontal"),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS(style.AttrMinimumSize { X: 48 }),
|
2024-05-07 03:25:53 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
// *.Slider[vertical]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-05-27 20:02:57 +00:00
|
|
|
Role: tomo.R("", "Slider", "vertical"),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS(style.AttrMinimumSize { Y: 48 }),
|
2024-05-07 03:25:53 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
// *.SliderHandle[*]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-05-27 20:02:57 +00:00
|
|
|
Role: tomo.R("", "SliderHandle", ""),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-05-07 03:25:53 +00:00
|
|
|
outline,
|
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(1),
|
|
|
|
Color: borderColorLifted,
|
|
|
|
},
|
|
|
|
},
|
2024-06-12 04:19:12 +00:00
|
|
|
style.AttrColor { Color: tomo.ColorRaised },
|
|
|
|
style.AttrMinimumSize { X: 12, Y: 12, },
|
2024-05-07 03:25:53 +00:00
|
|
|
),
|
|
|
|
},
|
2024-05-08 00:22:53 +00:00
|
|
|
|
|
|
|
// *.Checkbox[*]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-05-27 20:02:57 +00:00
|
|
|
Role: tomo.R("", "Checkbox", ""),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-05-08 00:22:53 +00:00
|
|
|
outline,
|
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
|
|
Color: borderColorEngraved,
|
|
|
|
},
|
|
|
|
},
|
2024-06-12 04:19:12 +00:00
|
|
|
style.AttrColor { Color: tomo.ColorSunken },
|
|
|
|
style.AttrPadding(tomo.I(0, 1, 1, 0)),
|
|
|
|
style.AttrMinimumSize { X: 19, Y: 19 },
|
2024-05-08 00:22:53 +00:00
|
|
|
),
|
2024-06-12 04:19:12 +00:00
|
|
|
Focused: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-05-08 00:22:53 +00:00
|
|
|
outline,
|
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(1),
|
|
|
|
Color: borderColorFocused,
|
|
|
|
},
|
|
|
|
},
|
2024-06-12 04:19:12 +00:00
|
|
|
style.AttrPadding(tomo.I(0)),
|
2024-05-08 00:22:53 +00:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.LabelCheckbox[*]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-05-27 20:02:57 +00:00
|
|
|
Role: tomo.R("", "LabelCheckbox", ""),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrGap { X: 8, Y: 8 },
|
2024-05-08 00:22:53 +00:00
|
|
|
),
|
|
|
|
},
|
2024-05-29 01:57:48 +00:00
|
|
|
|
|
|
|
// *.MenuItem[*]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-05-29 01:57:48 +00:00
|
|
|
Role: tomo.R("", "MenuItem", ""),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrPadding(tomo.I(4)),
|
|
|
|
style.AttrGap { X: 4, Y: 4 },
|
|
|
|
style.AttrColor { Color: color.Transparent },
|
2024-05-29 01:57:48 +00:00
|
|
|
),
|
2024-06-12 04:19:12 +00:00
|
|
|
Hovered: style.AS (
|
|
|
|
style.AttrColor { Color: tomo.ColorAccent },
|
2024-05-29 01:57:48 +00:00
|
|
|
),
|
2024-06-12 04:19:12 +00:00
|
|
|
Focused: style.AS (
|
|
|
|
style.AttrColor { Color: tomo.ColorAccent },
|
2024-05-29 01:57:48 +00:00
|
|
|
),
|
|
|
|
},
|
2024-06-03 07:04:29 +00:00
|
|
|
|
|
|
|
// *.File[*]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-06-03 07:04:29 +00:00
|
|
|
Role: tomo.R("", "File", ""),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrColor { Color: color.Transparent },
|
2024-06-03 07:04:29 +00:00
|
|
|
),
|
2024-06-12 04:19:12 +00:00
|
|
|
Focused: style.AS (
|
|
|
|
style.AttrColor { Color: tomo.ColorAccent },
|
2024-06-03 07:04:29 +00:00
|
|
|
),
|
|
|
|
},
|
2024-06-07 21:36:10 +00:00
|
|
|
|
|
|
|
// *.TearLine[*]
|
2024-06-12 04:19:12 +00:00
|
|
|
style.Rule {
|
2024-06-07 21:36:10 +00:00
|
|
|
Role: tomo.R("", "TearLine", ""),
|
2024-06-12 04:19:12 +00:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-07 21:36:10 +00:00
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(3),
|
|
|
|
Color: [4]color.Color {
|
|
|
|
color.Transparent,
|
|
|
|
color.Transparent,
|
|
|
|
color.Transparent,
|
|
|
|
color.Transparent,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-06-12 04:19:12 +00:00
|
|
|
style.AttrColor { Color: tomo.ColorForeground },
|
|
|
|
style.AttrPadding(tomo.I(1, 0, 0, 1)),
|
2024-06-07 21:36:10 +00:00
|
|
|
),
|
2024-06-12 04:19:12 +00:00
|
|
|
Hovered: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-07 21:36:10 +00:00
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(3),
|
|
|
|
Color: borderColorFocused,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
2024-06-12 04:19:12 +00:00
|
|
|
Focused: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-07 21:36:10 +00:00
|
|
|
tomo.Border {
|
|
|
|
Width: tomo.I(3),
|
|
|
|
Color: borderColorFocused,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
},
|
2024-05-07 03:25:53 +00:00
|
|
|
}
|