nasin/internal/style/fallback/style.go
2024-07-26 17:54:06 -04:00

499 lines
12 KiB
Go

package fallbackStyle
import "image/color"
import "git.tebibyte.media/tomo/tomo"
import "golang.org/x/image/font/basicfont"
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 = []tomo.Rule {
// *.*
tomo.Ru(tomo.AS (
tomo.AFace (basicfont.Face7x13 ),
tomo.ATextColor (tomo.ColorForeground),
tomo.ADotColor (tomo.ColorAccent ),
tomo.AGap (8, 8 ),
), tomo.R("", "")),
// *.Button
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
Width: tomo.I(1),
Color: borderColorLifted,
},
},
tomo.AttrPadding(tomo.I(4, 8)),
tomo.AttrColor { Color: tomo.ColorRaised },
), tomo.R("", "Button")),
// *.Button[focused]
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
Width: tomo.I(1),
Color: borderColorFocused,
},
},
tomo.AttrPadding(tomo.I(4, 8)),
), tomo.R("", "Button"), "focused"),
// *.Button[pressed]
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
Width: tomo.I(1, 0, 0, 1),
Color: borderColorEngraved,
},
},
tomo.AttrPadding(tomo.I(5, 8, 4, 9)),
tomo.AttrColor { Color: colorCarvedPressed },
), tomo.R("", "Button"), "pressed"),
// *.TextInput
tomo.Ru(tomo.AS (
tomo.ABorder (
outline,
tomo.Border {
Width: tomo.I(1),
Color: borderColorInput,
}),
tomo.AColor(colorInput),
tomo.APadding(5, 4, 4, 5),
), tomo.R("", "TextInput")),
// *.TextInput[focused]
tomo.Ru(tomo.AS (
tomo.ABorder (
outline,
tomo.Border {
Width: tomo.I(1),
Color: borderColorFocused,
}),
), tomo.R("", "TextInput"), "focused"),
// *.TextView
tomo.Ru(tomo.AS (
tomo.ABorder (
outline,
tomo.Border {
Width: tomo.I(1, 0, 0, 1),
Color: borderColorEngraved,
}),
tomo.AColor(tomo.ColorSunken),
tomo.APadding(8),
), tomo.R("", "TextView")),
// *.NumberInput
tomo.Ru(tomo.AS (
tomo.AGap(0, 0),
), tomo.R("", "NumberInput")),
// *.Container[sunken]
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
Width: tomo.I(1, 0, 0, 1),
Color: borderColorEngraved,
},
},
tomo.AttrColor { Color: tomo.ColorSunken },
tomo.AttrPadding(tomo.I(8)),
), tomo.R("", "Container"), "sunken"),
// *.Container[outer]
tomo.Ru(tomo.AS (
tomo.AttrColor { Color: tomo.ColorBackground },
tomo.AttrPadding(tomo.I(8)),
), tomo.R("", "Container"), "outer"),
// *.Container[menu]
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
Width: tomo.I(1),
Color: borderColorLifted,
},
},
tomo.AttrColor { Color: tomo.ColorBackground },
tomo.AttrGap { },
), tomo.R("", "Container"), "menu"),
// *.Heading
tomo.Ru(tomo.AS (
tomo.AAlign(tomo.AlignMiddle, tomo.AlignMiddle),
), tomo.R("", "Heading")),
// *.Separator
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(1),
Color: borderColorEngraved,
},
},
), tomo.R("", "Separator")),
// *.Slider
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
Width: tomo.I(1, 0, 0, 1),
Color: borderColorEngraved,
},
},
tomo.AttrColor { Color: colorGutter },
tomo.AttrPadding(tomo.I(0, 1, 1, 0)),
), tomo.R("", "Slider")),
// *.Slider[focused]
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
Width: tomo.I(1),
Color: borderColorFocused,
},
},
tomo.AttrPadding(tomo.I(0)),
), tomo.R("", "Slider"), "focused"),
// *.Slider[horizontal]
tomo.Ru(tomo.AS (
tomo.AMinimumSize(48, 0),
), tomo.R("", "Slider"), "horizontal"),
// *.Slider[vertical]
tomo.Ru(tomo.AS (
tomo.AMinimumSize(0, 48),
), tomo.R("", "Slider"), "vertical"),
// *.SliderHandle
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
Width: tomo.I(1),
Color: borderColorLifted,
},
},
tomo.AttrColor { Color: tomo.ColorRaised },
tomo.AttrMinimumSize { X: 12, Y: 12, },
), tomo.R("", "SliderHandle")),
// *.ScrollContainer
tomo.Ru(tomo.AS (
tomo.AGap(0, 0),
), tomo.R("", "ScrollContainer")),
// *.Checkbox
tomo.Ru(tomo.AS (
tomo.ABorder (
outline,
tomo.Border {
Width: tomo.I(1, 0, 0, 1),
Color: borderColorEngraved,
}),
tomo.AColor(tomo.ColorSunken),
tomo.APadding(0, 1, 1, 0),
tomo.AMinimumSize(19, 19),
tomo.ATexture(nil),
tomo.ATextureMode(tomo.TextureModeCenter),
), tomo.R("", "Checkbox")),
// *.Checkbox[focused]
tomo.Ru(tomo.AS (
tomo.ABorder (
outline,
tomo.Border {
Width: tomo.I(1),
Color: borderColorFocused,
}),
tomo.APadding(0),
), tomo.R("", "Checkbox"), "focused"),
// *.Checkbox[checked]
tomo.Ru(tomo.AS (
tomo.ATexture(nil), // TODO: checked texture
), tomo.R("", "Checkbox"), "checked"),
// *.MenuItem
tomo.Ru(tomo.AS (
tomo.AttrPadding(tomo.I(4)),
tomo.AttrGap { X: 4, Y: 4 },
tomo.AttrColor { Color: color.Transparent },
), tomo.R("", "MenuItem")),
// *MenuItem[focused]
tomo.Ru(tomo.AS (
tomo.AttrColor { Color: tomo.ColorAccent },
), tomo.R("", "MenuItem"), "focused"),
// *.MenuItem[hovered]
tomo.Ru(tomo.AS (
tomo.AttrColor { Color: tomo.ColorAccent },
), tomo.R("", "MenuItem"), "hovered"),
// *.File
tomo.Ru(tomo.AS (
tomo.AttrColor { Color: color.Transparent },
), tomo.R("", "File")),
// *.File[focused]
tomo.Ru(tomo.AS (
tomo.AttrColor { Color: tomo.ColorAccent },
), tomo.R("", "File"), "focused"),
// *.TearLine
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(3),
Color: [4]color.Color {
color.Transparent,
color.Transparent,
color.Transparent,
color.Transparent,
},
},
},
tomo.AttrColor { Color: tomo.ColorForeground },
tomo.AttrPadding(tomo.I(1, 0, 0, 1)),
), tomo.R("", "TearLine")),
// *.TearLine[focused]
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(3),
Color: borderColorFocused,
},
},
), tomo.R("", "TearLine"), "focused"),
// *.TearLine[hovered]
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(3),
Color: borderColorFocused,
},
},
), tomo.R("", "TearLine"), "hovered"),
// *.Calendar
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(0, 1, 1, 0),
Color: borderColorShade,
},
outline,
},
tomo.AttrColor { Color: colorInput },
tomo.AttrPadding(tomo.I(2)),
tomo.AttrGap { X: 2, Y: 2 },
), tomo.R("", "Calendar")),
// *.CalendarGrid
tomo.Ru(tomo.AS (
tomo.AttrGap { X: 2, Y: 2 },
), tomo.R("", "CalendarGrid")),
// *.CalendarWeekdayHeader
tomo.Ru(tomo.AS (
tomo.AttrPadding(tomo.I(2)),
tomo.AttrColor { Color: colorCalendarWeekdayHeader },
), tomo.R("", "CalendarWeekdayHeader")),
// *.CalendarDay[weekday]
tomo.Ru(tomo.AS (
tomo.AttrPadding(tomo.I(2)),
tomo.AttrMinimumSize { X: 32, Y: 32 },
tomo.AttrColor { Color: colorCalendarDay },
), tomo.R("", "CalendarDay"), "weekday"),
// *.CalendarDay[weekend]
tomo.Ru(tomo.AS (
tomo.AttrPadding(tomo.I(2)),
tomo.AttrMinimumSize { X: 32, Y: 32 },
tomo.AttrColor { Color: colorCalendarWeekend },
), tomo.R("", "CalendarDay"), "weekend"),
// *.TabbedContainer
tomo.Ru(tomo.AS (
tomo.AGap(0, 0),
), tomo.R("", "TabbedContainer")),
// *.TabRow
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(1, 1, 0, 1),
Color: borderColorOutline,
},
tomo.Border {
Width: tomo.I(1, 0, 0, 1),
Color: borderColorEngraved,
},
},
tomo.AttrGap { X: 0, Y: 0 },
tomo.AttrColor { Color: colorGutter },
tomo.AttrPadding(tomo.I(1, 0, 0, 0)),
), tomo.R("", "TabRow")),
// *.TabSpacer[left]
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(0, 0, 1, 0),
Color: borderColorEngraved,
},
tomo.Border {
Width: tomo.I(0, 0, 1, 0),
Color: borderColorOutline,
},
},
tomo.AttrMinimumSize { X: 1 },
), tomo.R("", "TabSpacer")),
// *.TabSpacer[right]
tomo.Ru(tomo.AS (
tomo.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,
},
},
tomo.AttrMinimumSize { X: 3 },
), tomo.R("", "TabSpacer"), "right"),
// *.Tab
tomo.Ru(tomo.AS (
tomo.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,
},
},
tomo.AttrPadding(tomo.I(4, 8, 4, 8)),
tomo.AttrColor { Color: tomo.ColorRaised },
), tomo.R("", "Tab")),
// *.Tab[active]
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(1, 0, 0, 1),
Color: borderColorOutline,
},
tomo.Border {
Width: tomo.I(1, 1, 0, 1),
Color: borderColorLifted,
},
},
tomo.AttrPadding(tomo.I(4, 8, 4, 8)),
tomo.AttrColor { Color: tomo.ColorBackground },
), tomo.R("", "Tab"), "active"),
// *.Swatch
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
},
tomo.AttrMinimumSize { X: 19, Y: 19 },
), tomo.R("", "Swatch")),
// *.Swatch[focused]
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
Width: tomo.I(1),
Color: borderColorFocused,
},
},
), tomo.R("", "Swatch"), "focused"),
// *.ColorPickerMap
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
Width: tomo.I(1, 0, 0, 1),
Color: borderColorEngraved,
},
},
tomo.AttrColor { Color: tomo.ColorSunken },
tomo.AttrMinimumSize { X: 128, Y: 128 },
), tomo.R("", "ColorPickerMap")),
}