559 lines
12 KiB
Go
559 lines
12 KiB
Go
package fallbackStyle
|
|
|
|
import "image/color"
|
|
import "git.tebibyte.media/tomo/tomo"
|
|
import "golang.org/x/image/font/basicfont"
|
|
import "git.tebibyte.media/tomo/nasin/internal/style"
|
|
|
|
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 colorShade = color.RGBA { A: 128 }
|
|
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 colorCalendarWeekdayHeader = color.RGBA { R: 194, G: 162, B: 132, A: 255 }
|
|
var colorCalendarWeekend = color.RGBA { R: 165, G: 185, B: 120, A: 255 }
|
|
var colorCalendarDay = color.RGBA { R: 194, G: 189, B: 132, A: 255 }
|
|
var colorInactive = color.RGBA { R: 131, G: 147, B: 134, A: 255 }
|
|
|
|
var outline = tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: [4]color.Color {
|
|
colorOutline,
|
|
colorOutline,
|
|
colorOutline,
|
|
colorOutline,
|
|
},
|
|
}
|
|
|
|
var borderColorOutline = [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 borderColorShade = [4]color.Color { colorShade, colorShade, colorShade, colorShade }
|
|
|
|
var rules = []style.Rule {
|
|
// *.*[*]
|
|
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 },
|
|
),
|
|
},
|
|
|
|
// *.Button[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "Button", ""),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorLifted,
|
|
},
|
|
},
|
|
style.AttrPadding(tomo.I(4, 8)),
|
|
style.AttrColor { Color: tomo.ColorRaised },
|
|
),
|
|
Pressed: style.AS (
|
|
style.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
Color: borderColorEngraved,
|
|
},
|
|
},
|
|
style.AttrPadding(tomo.I(5, 8, 4, 9)),
|
|
style.AttrColor { Color: colorCarvedPressed },
|
|
),
|
|
Focused: style.AS (
|
|
style.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorFocused,
|
|
},
|
|
},
|
|
style.AttrPadding(tomo.I(4, 8)),
|
|
),
|
|
},
|
|
|
|
// *.TextInput[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "TextInput", ""),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorInput,
|
|
},
|
|
},
|
|
style.AttrColor { Color: colorInput },
|
|
style.AttrPadding(tomo.I(5, 4, 4, 5)),
|
|
),
|
|
Focused: style.AS (
|
|
style.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorFocused,
|
|
},
|
|
},
|
|
),
|
|
},
|
|
|
|
// *.TextView[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "TextView", ""),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
Color: borderColorEngraved,
|
|
},
|
|
},
|
|
style.AttrColor { Color: tomo.ColorSunken },
|
|
style.AttrPadding(tomo.I(8)),
|
|
),
|
|
},
|
|
|
|
// *.NumberInput[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "NumberInput", ""),
|
|
Default: style.AS (
|
|
style.AttrGap { },
|
|
),
|
|
},
|
|
|
|
// *.Container[sunken]
|
|
style.Rule {
|
|
Role: tomo.R("", "Container", "sunken"),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
Color: borderColorEngraved,
|
|
},
|
|
},
|
|
style.AttrColor { Color: tomo.ColorSunken },
|
|
style.AttrPadding(tomo.I(8)),
|
|
),
|
|
},
|
|
|
|
// *.Container[outer]
|
|
style.Rule {
|
|
Role: tomo.R("", "Container", "outer"),
|
|
Default: style.AS (
|
|
style.AttrColor { Color: tomo.ColorBackground },
|
|
style.AttrPadding(tomo.I(8)),
|
|
),
|
|
},
|
|
|
|
// *.Container[menu]
|
|
style.Rule {
|
|
Role: tomo.R("", "Container", "menu"),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorLifted,
|
|
},
|
|
},
|
|
style.AttrColor { Color: tomo.ColorBackground },
|
|
style.AttrGap { },
|
|
),
|
|
},
|
|
|
|
// *.Heading[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "Heading", ""),
|
|
Default: style.AS (
|
|
style.AttrAlign { X: tomo.AlignMiddle, Y: tomo.AlignMiddle },
|
|
),
|
|
},
|
|
|
|
// *.Separator[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "Separator", ""),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorEngraved,
|
|
},
|
|
},
|
|
),
|
|
},
|
|
|
|
// *.Slider[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "Slider", ""),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
Color: borderColorEngraved,
|
|
},
|
|
},
|
|
style.AttrColor { Color: colorGutter },
|
|
style.AttrPadding(tomo.I(0, 1, 1, 0)),
|
|
),
|
|
Focused: style.AS (
|
|
style.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorFocused,
|
|
},
|
|
},
|
|
style.AttrPadding(tomo.I(0)),
|
|
),
|
|
},
|
|
|
|
// *.Slider[horizontal]
|
|
style.Rule {
|
|
Role: tomo.R("", "Slider", "horizontal"),
|
|
Default: style.AS(style.AttrMinimumSize { X: 48 }),
|
|
},
|
|
|
|
// *.Slider[vertical]
|
|
style.Rule {
|
|
Role: tomo.R("", "Slider", "vertical"),
|
|
Default: style.AS(style.AttrMinimumSize { Y: 48 }),
|
|
},
|
|
|
|
// *.SliderHandle[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "SliderHandle", ""),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorLifted,
|
|
},
|
|
},
|
|
style.AttrColor { Color: tomo.ColorRaised },
|
|
style.AttrMinimumSize { X: 12, Y: 12, },
|
|
),
|
|
},
|
|
|
|
// *.Checkbox[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "Checkbox", ""),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
Color: borderColorEngraved,
|
|
},
|
|
},
|
|
style.AttrColor { Color: tomo.ColorSunken },
|
|
style.AttrPadding(tomo.I(0, 1, 1, 0)),
|
|
style.AttrMinimumSize { X: 19, Y: 19 },
|
|
),
|
|
Focused: style.AS (
|
|
style.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorFocused,
|
|
},
|
|
},
|
|
style.AttrPadding(tomo.I(0)),
|
|
),
|
|
},
|
|
|
|
// *.MenuItem[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "MenuItem", ""),
|
|
Default: style.AS (
|
|
style.AttrPadding(tomo.I(4)),
|
|
style.AttrGap { X: 4, Y: 4 },
|
|
style.AttrColor { Color: color.Transparent },
|
|
),
|
|
Hovered: style.AS (
|
|
style.AttrColor { Color: tomo.ColorAccent },
|
|
),
|
|
Focused: style.AS (
|
|
style.AttrColor { Color: tomo.ColorAccent },
|
|
),
|
|
},
|
|
|
|
// *.File[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "File", ""),
|
|
Default: style.AS (
|
|
style.AttrColor { Color: color.Transparent },
|
|
),
|
|
Focused: style.AS (
|
|
style.AttrColor { Color: tomo.ColorAccent },
|
|
),
|
|
},
|
|
|
|
// *.TearLine[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "TearLine", ""),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
tomo.Border {
|
|
Width: tomo.I(3),
|
|
Color: [4]color.Color {
|
|
color.Transparent,
|
|
color.Transparent,
|
|
color.Transparent,
|
|
color.Transparent,
|
|
},
|
|
},
|
|
},
|
|
style.AttrColor { Color: tomo.ColorForeground },
|
|
style.AttrPadding(tomo.I(1, 0, 0, 1)),
|
|
),
|
|
Hovered: style.AS (
|
|
style.AttrBorder {
|
|
tomo.Border {
|
|
Width: tomo.I(3),
|
|
Color: borderColorFocused,
|
|
},
|
|
},
|
|
),
|
|
Focused: style.AS (
|
|
style.AttrBorder {
|
|
tomo.Border {
|
|
Width: tomo.I(3),
|
|
Color: borderColorFocused,
|
|
},
|
|
},
|
|
),
|
|
},
|
|
|
|
// *.Calendar[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "Calendar", ""),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
tomo.Border {
|
|
Width: tomo.I(0, 1, 1, 0),
|
|
Color: borderColorShade,
|
|
},
|
|
outline,
|
|
},
|
|
style.AttrColor { Color: colorInput },
|
|
style.AttrPadding(tomo.I(2)),
|
|
style.AttrGap { X: 2, Y: 2 },
|
|
),
|
|
},
|
|
|
|
// *.CalendarGrid[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "CalendarGrid", ""),
|
|
Default: style.AS (
|
|
style.AttrGap { X: 2, Y: 2 },
|
|
),
|
|
},
|
|
|
|
// *.CalendarWeekdayHeader[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "CalendarWeekdayHeader", ""),
|
|
Default: style.AS (
|
|
style.AttrPadding(tomo.I(2)),
|
|
style.AttrColor { Color: colorCalendarWeekdayHeader },
|
|
),
|
|
},
|
|
|
|
// *.CalendarDay[weekday]
|
|
style.Rule {
|
|
Role: tomo.R("", "CalendarDay", "weekday"),
|
|
Default: style.AS (
|
|
style.AttrPadding(tomo.I(2)),
|
|
style.AttrMinimumSize { X: 32, Y: 32 },
|
|
style.AttrColor { Color: colorCalendarDay },
|
|
),
|
|
},
|
|
|
|
// *.CalendarDay[weekend]
|
|
style.Rule {
|
|
Role: tomo.R("", "CalendarDay", "weekend"),
|
|
Default: style.AS (
|
|
style.AttrPadding(tomo.I(2)),
|
|
style.AttrMinimumSize { X: 32, Y: 32 },
|
|
style.AttrColor { Color: colorCalendarWeekend },
|
|
),
|
|
},
|
|
|
|
// *.TabbedContainer[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "TabbedContainer", ""),
|
|
Default: style.AS (
|
|
style.AttrGap { },
|
|
),
|
|
},
|
|
|
|
// *.TabRow[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "TabRow", ""),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
tomo.Border {
|
|
Width: tomo.I(1, 1, 0, 1),
|
|
Color: borderColorOutline,
|
|
},
|
|
tomo.Border {
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
Color: borderColorEngraved,
|
|
},
|
|
},
|
|
style.AttrGap { X: 0, Y: 0 },
|
|
style.AttrColor { Color: colorGutter },
|
|
style.AttrPadding(tomo.I(1, 0, 0, 0)),
|
|
),
|
|
},
|
|
|
|
// *.TabSpacer[left]
|
|
style.Rule {
|
|
Role: tomo.R("", "TabSpacer", "left"),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
tomo.Border {
|
|
Width: tomo.I(0, 0, 1, 0),
|
|
Color: borderColorEngraved,
|
|
},
|
|
tomo.Border {
|
|
Width: tomo.I(0, 0, 1, 0),
|
|
Color: borderColorOutline,
|
|
},
|
|
},
|
|
style.AttrMinimumSize { X: 1 },
|
|
),
|
|
},
|
|
|
|
// *.TabSpacer[right]
|
|
style.Rule {
|
|
Role: tomo.R("", "TabSpacer", "right"),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
tomo.Border {
|
|
Width: tomo.I(1, 0, 0, 0),
|
|
Color: [4]color.Color {
|
|
colorGutter, colorGutter,
|
|
colorGutter, colorGutter,
|
|
},
|
|
},
|
|
tomo.Border {
|
|
Width: tomo.I(0, 0, 1, 0),
|
|
Color: borderColorEngraved,
|
|
},
|
|
tomo.Border {
|
|
Width: tomo.I(0, 0, 1, 1),
|
|
Color: borderColorOutline,
|
|
},
|
|
tomo.Border {
|
|
Width: tomo.I(0, 0, 0, 1),
|
|
Color: borderColorShade,
|
|
},
|
|
},
|
|
style.AttrMinimumSize { X: 3 },
|
|
),
|
|
},
|
|
|
|
// *.Tab[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "Tab", ""),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
tomo.Border {
|
|
Width: tomo.I(1, 0, 0, 0),
|
|
Color: [4]color.Color {
|
|
colorGutter, colorGutter,
|
|
colorGutter, colorGutter,
|
|
},
|
|
},
|
|
tomo.Border {
|
|
Width: tomo.I(0, 0, 1, 0),
|
|
Color: borderColorEngraved,
|
|
},
|
|
tomo.Border {
|
|
Width: tomo.I(1, 0, 1, 1),
|
|
Color: borderColorOutline,
|
|
},
|
|
tomo.Border {
|
|
Width: tomo.I(1, 1, 0, 1),
|
|
Color: borderColorLifted,
|
|
},
|
|
},
|
|
style.AttrPadding(tomo.I(4, 8, 4, 8)),
|
|
style.AttrColor { Color: tomo.ColorRaised },
|
|
),
|
|
},
|
|
|
|
// *.Tab[active]
|
|
style.Rule {
|
|
Role: tomo.R("", "Tab", "active"),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
tomo.Border {
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
Color: borderColorOutline,
|
|
},
|
|
tomo.Border {
|
|
Width: tomo.I(1, 1, 0, 1),
|
|
Color: borderColorLifted,
|
|
},
|
|
},
|
|
style.AttrPadding(tomo.I(4, 8, 4, 8)),
|
|
style.AttrColor { Color: tomo.ColorBackground },
|
|
),
|
|
},
|
|
|
|
// *.Swatch[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "Swatch", ""),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
outline,
|
|
},
|
|
style.AttrMinimumSize { X: 19, Y: 19 },
|
|
),
|
|
Focused: style.AS (
|
|
style.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1),
|
|
Color: borderColorFocused,
|
|
},
|
|
},
|
|
),
|
|
},
|
|
|
|
// *.ColorPickerMap[*]
|
|
style.Rule {
|
|
Role: tomo.R("", "ColorPickerMap", ""),
|
|
Default: style.AS (
|
|
style.AttrBorder {
|
|
outline,
|
|
tomo.Border {
|
|
Width: tomo.I(1, 0, 0, 1),
|
|
Color: borderColorEngraved,
|
|
},
|
|
},
|
|
style.AttrColor { Color: tomo.ColorSunken },
|
|
style.AttrMinimumSize { X: 128, Y: 128 },
|
|
),
|
|
},
|
|
}
|