2024-06-03 01:48:13 -06:00
|
|
|
package aluminumStyle
|
|
|
|
|
|
|
|
import "image/color"
|
|
|
|
import "git.tebibyte.media/tomo/tomo"
|
|
|
|
import "golang.org/x/image/font/basicfont"
|
|
|
|
|
|
|
|
func hex (color uint32) (c color.RGBA) {
|
|
|
|
c.A = uint8(color)
|
|
|
|
c.B = uint8(color >> 8)
|
|
|
|
c.G = uint8(color >> 16)
|
|
|
|
c.R = uint8(color >> 24)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func border (top, right, bottom, left uint32, width ...int) tomo.Border {
|
|
|
|
return tomo.Border {
|
|
|
|
Width: tomo.I(width...),
|
|
|
|
Color: [4]color.Color {
|
|
|
|
hex(top), hex(right),
|
|
|
|
hex(bottom), hex(left),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-18 22:31:50 -06:00
|
|
|
var colorDot = hex(0x7391c080)
|
|
|
|
var colorFocus = hex(0x5f8bc4FF)
|
|
|
|
var colorHighlight = hex(0x5f8bc4FF)
|
|
|
|
var colorBackground = hex(0xd4d4d4FF)
|
|
|
|
var colorForeground = color.Black
|
2024-06-03 20:49:02 -06:00
|
|
|
|
2024-06-18 22:31:50 -06:00
|
|
|
var colorOutline = color.Black
|
|
|
|
var colorGutter = hex(0xbfc6d1FF)
|
|
|
|
var colorGutterHovered = hex(0xc5cbd6FF)
|
|
|
|
var colorRaised = hex(0xe9eaeaFF)
|
|
|
|
var colorRaisedPressed = hex(0xccd4ddFF)
|
|
|
|
var colorRaisedFocused = hex(0xcfd6ddFF)
|
|
|
|
var colorRaisedHovered = hex(0xf1f3f5FF)
|
|
|
|
var colorSunken = hex(0xe9eaeaFF)
|
|
|
|
var colorSunkenFocused = hex(0xe0e6eeFF)
|
|
|
|
var colorSunkenPressed = hex(0xe0e6eeFF)
|
|
|
|
var colorCalendarWeekdayHeader = hex(0xd3cac2FF)
|
|
|
|
var colorCalendarWeekend = hex(0xc2d3c4FF)
|
|
|
|
var colorCalendarDay = hex(0xd6dae2FF)
|
2024-06-03 01:48:13 -06:00
|
|
|
|
|
|
|
var outline = tomo.Border {
|
|
|
|
Width: tomo.I(1),
|
|
|
|
Color: [4]color.Color {
|
|
|
|
colorOutline,
|
|
|
|
colorOutline,
|
|
|
|
colorOutline,
|
|
|
|
colorOutline,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2024-06-07 15:36:10 -06:00
|
|
|
var borderEngraved = border(0xc3c3c5FF, 0xe3e3e3FF, 0xe9e9e9ff, 0xc2c2c2ff, 1)
|
|
|
|
var borderGap = border(0x697c7cFF, 0x566767FF, 0x566767ff, 0x697c7cff, 1)
|
|
|
|
var borderLifted = border(0xf9fafcFF, 0xc2c8d3FF, 0xa4afc0ff, 0xf5f6f8ff, 1)
|
|
|
|
var borderLiftedFocused = border(0xf0f4f9FF, 0xb1bacaFF, 0x9aa6b7ff, 0xe4e9eeff, 1)
|
|
|
|
var borderFocused = border(0x5f8bc4FF, 0x5f8bc4FF, 0x5f8bc4ff, 0x5f8bc4ff, 1)
|
|
|
|
var borderTear = borderEngraved
|
|
|
|
var borderTearFocused = border(0x7f94b5FF, 0xced7e4FF, 0xced7e4FF, 0x7f94b5FF, 1)
|
|
|
|
var borderTearPad = border(0x00000000, 0x00000000, 0x00000000, 0x00000000, 3)
|
|
|
|
var borderTearPadFocused = border(0x7391c080, 0x7391c080, 0x7391c080, 0x7391c080, 3)
|
|
|
|
var borderInnerShadow = border(0xa4afc0FF, 0xa4afc0FF, 0xa4afc0ff, 0xa4afc0ff, 1, 0, 0, 1)
|
|
|
|
var borderOuterShadow = border(0xa4afc0FF, 0xa4afc0FF, 0xa4afc0ff, 0xa4afc0ff, 0, 1, 1, 0)
|
2024-06-03 01:48:13 -06:00
|
|
|
|
2024-06-11 22:19:12 -06:00
|
|
|
var rules = []style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
// *.*[*]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
|
|
|
Default: style.AS (
|
|
|
|
style.AttrFace { Face: basicfont.Face7x13 },
|
|
|
|
style.AttrTextColor { Color: tomo.ColorForeground },
|
|
|
|
style.AttrDotColor { Color: colorDot },
|
|
|
|
style.AttrGap { X: 8, Y: 8 },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.Button[*]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "Button", ""),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-03 01:48:13 -06:00
|
|
|
borderEngraved,
|
|
|
|
borderGap,
|
|
|
|
borderLifted,
|
|
|
|
},
|
2024-06-11 22:19:12 -06:00
|
|
|
style.AttrPadding(tomo.I(4, 8)),
|
|
|
|
style.AttrColor { Color: tomo.ColorRaised },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
2024-06-11 22:19:12 -06:00
|
|
|
Pressed: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-03 01:48:13 -06:00
|
|
|
borderEngraved,
|
|
|
|
borderGap,
|
|
|
|
borderInnerShadow,
|
|
|
|
},
|
2024-06-11 22:19:12 -06:00
|
|
|
style.AttrPadding(tomo.I(5, 8, 4, 9)),
|
|
|
|
style.AttrColor { Color: colorRaisedPressed },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
2024-06-11 22:19:12 -06:00
|
|
|
Focused: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-03 01:48:13 -06:00
|
|
|
borderEngraved,
|
2024-06-03 20:49:02 -06:00
|
|
|
borderGap,
|
|
|
|
borderLiftedFocused,
|
2024-06-03 01:48:13 -06:00
|
|
|
},
|
2024-06-11 22:19:12 -06:00
|
|
|
style.AttrPadding(tomo.I(4, 8)),
|
|
|
|
style.AttrColor { Color: colorRaisedFocused },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
2024-06-11 22:19:12 -06:00
|
|
|
Hovered: style.AS (
|
|
|
|
style.AttrColor { Color: colorRaisedHovered },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.TextInput[*]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "TextInput", ""),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-03 01:48:13 -06:00
|
|
|
borderEngraved,
|
|
|
|
borderGap,
|
|
|
|
borderInnerShadow,
|
|
|
|
},
|
2024-06-11 22:19:12 -06:00
|
|
|
style.AttrColor { Color: tomo.ColorSunken },
|
|
|
|
style.AttrPadding(tomo.I(5, 4, 4, 5)),
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
2024-06-11 22:19:12 -06:00
|
|
|
Focused: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-03 01:48:13 -06:00
|
|
|
borderEngraved,
|
|
|
|
borderFocused,
|
|
|
|
borderInnerShadow,
|
|
|
|
},
|
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.TextView[*]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "TextView", ""),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-03 01:48:13 -06:00
|
|
|
borderEngraved,
|
|
|
|
borderGap,
|
|
|
|
borderInnerShadow,
|
|
|
|
},
|
2024-06-11 22:19:12 -06:00
|
|
|
style.AttrColor { Color: tomo.ColorSunken },
|
|
|
|
style.AttrPadding(tomo.I(8)),
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.NumberInput[*]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "NumberInput", ""),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrGap { },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.Container[sunken]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "Container", "sunken"),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-03 01:48:13 -06:00
|
|
|
borderEngraved,
|
|
|
|
borderGap,
|
|
|
|
borderInnerShadow,
|
|
|
|
},
|
2024-06-11 22:19:12 -06:00
|
|
|
style.AttrColor { Color: tomo.ColorSunken },
|
|
|
|
style.AttrPadding(tomo.I(8)),
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.Container[outer]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "Container", "outer"),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrColor { Color: tomo.ColorBackground },
|
|
|
|
style.AttrPadding(tomo.I(8)),
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.Container[menu]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "Container", "menu"),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-03 01:48:13 -06:00
|
|
|
borderGap,
|
|
|
|
borderLifted,
|
|
|
|
},
|
2024-06-11 22:19:12 -06:00
|
|
|
style.AttrColor { Color: tomo.ColorBackground },
|
|
|
|
style.AttrGap { },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.Heading[*]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "Heading", ""),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrAlign { X: tomo.AlignMiddle, Y: tomo.AlignMiddle },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.Separator[*]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "Separator", ""),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-03 01:48:13 -06:00
|
|
|
borderEngraved,
|
|
|
|
},
|
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.Slider[*]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "Slider", ""),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-03 01:48:13 -06:00
|
|
|
borderEngraved,
|
|
|
|
borderGap,
|
|
|
|
borderInnerShadow,
|
|
|
|
},
|
2024-06-11 22:19:12 -06:00
|
|
|
style.AttrColor { Color: colorGutter },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
2024-06-11 22:19:12 -06:00
|
|
|
Focused: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-03 01:48:13 -06:00
|
|
|
borderEngraved,
|
|
|
|
borderFocused,
|
|
|
|
borderInnerShadow,
|
|
|
|
},
|
|
|
|
),
|
2024-06-11 22:19:12 -06:00
|
|
|
Hovered: style.AS (
|
|
|
|
style.AttrColor { Color: colorGutterHovered },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.Slider[horizontal]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "Slider", "horizontal"),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS(style.AttrMinimumSize { X: 48 }),
|
2024-06-03 01:48:13 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
// *.Slider[vertical]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "Slider", "vertical"),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS(style.AttrMinimumSize { Y: 48 }),
|
2024-06-03 01:48:13 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
// *.SliderHandle[*]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "SliderHandle", ""),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-03 01:48:13 -06:00
|
|
|
borderOuterShadow,
|
|
|
|
borderGap,
|
|
|
|
borderLifted,
|
|
|
|
},
|
2024-06-11 22:19:12 -06:00
|
|
|
style.AttrColor { Color: tomo.ColorRaised },
|
|
|
|
style.AttrMinimumSize { X: 12, Y: 12, },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.Checkbox[*]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "Checkbox", ""),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-03 01:48:13 -06:00
|
|
|
borderEngraved,
|
|
|
|
borderGap,
|
|
|
|
borderInnerShadow,
|
|
|
|
},
|
2024-06-11 22:19:12 -06:00
|
|
|
style.AttrColor { Color: tomo.ColorSunken },
|
|
|
|
style.AttrPadding(tomo.I(0, 1, 1, 0)),
|
|
|
|
style.AttrMinimumSize { X: 19, Y: 19 },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
2024-06-11 22:19:12 -06:00
|
|
|
Focused: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-03 01:48:13 -06:00
|
|
|
borderEngraved,
|
|
|
|
borderFocused,
|
|
|
|
borderInnerShadow,
|
|
|
|
},
|
2024-06-11 22:19:12 -06:00
|
|
|
style.AttrPadding(tomo.I(0)),
|
|
|
|
style.AttrColor { Color: colorSunkenFocused },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.LabelCheckbox[*]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "LabelCheckbox", ""),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrGap { X: 8, Y: 8 },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.MenuItem[*]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "MenuItem", ""),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrPadding(tomo.I(4)),
|
|
|
|
style.AttrGap { X: 4, Y: 4 },
|
|
|
|
style.AttrColor { Color: color.Transparent },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
2024-06-11 22:19:12 -06:00
|
|
|
Hovered: style.AS (
|
|
|
|
style.AttrColor { Color: colorDot },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
2024-06-11 22:19:12 -06:00
|
|
|
Focused: style.AS (
|
|
|
|
style.AttrColor { Color: colorDot },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
|
|
|
},
|
|
|
|
|
|
|
|
// *.File[*]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-03 01:48:13 -06:00
|
|
|
Role: tomo.R("", "File", ""),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrColor { Color: color.Transparent },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
2024-06-11 22:19:12 -06:00
|
|
|
Focused: style.AS (
|
|
|
|
style.AttrColor { Color: colorDot },
|
2024-06-03 01:48:13 -06:00
|
|
|
),
|
|
|
|
},
|
2024-06-07 15:36:10 -06:00
|
|
|
|
|
|
|
// *.TearLine[*]
|
2024-06-11 22:19:12 -06:00
|
|
|
style.Rule {
|
2024-06-07 15:36:10 -06:00
|
|
|
Role: tomo.R("", "TearLine", ""),
|
2024-06-11 22:19:12 -06:00
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-07 15:36:10 -06:00
|
|
|
borderTearPad,
|
|
|
|
borderTear,
|
|
|
|
},
|
|
|
|
),
|
2024-06-11 22:19:12 -06:00
|
|
|
Hovered: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-07 15:36:10 -06:00
|
|
|
borderTearPadFocused,
|
|
|
|
borderTearFocused,
|
|
|
|
},
|
|
|
|
),
|
2024-06-11 22:19:12 -06:00
|
|
|
Focused: style.AS (
|
|
|
|
style.AttrBorder {
|
2024-06-07 15:36:10 -06:00
|
|
|
borderTearPadFocused,
|
|
|
|
borderTearFocused,
|
|
|
|
},
|
|
|
|
),
|
|
|
|
},
|
2024-06-18 22:31:50 -06:00
|
|
|
|
|
|
|
// *.Calendar[*]
|
|
|
|
style.Rule {
|
|
|
|
Role: tomo.R("", "Calendar", ""),
|
|
|
|
Default: style.AS (
|
|
|
|
style.AttrBorder {
|
|
|
|
borderOuterShadow,
|
|
|
|
borderGap,
|
|
|
|
},
|
|
|
|
style.AttrColor { Color: tomo.ColorRaised },
|
|
|
|
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 },
|
|
|
|
),
|
|
|
|
},
|
2024-06-03 01:48:13 -06:00
|
|
|
}
|