Style tweaks

This commit is contained in:
Sasha Koshka 2024-07-27 21:36:00 -04:00
parent ac4ced365a
commit 4f96ca51c2
5 changed files with 533 additions and 500 deletions

View File

@ -23,7 +23,7 @@ func SetTheme () error {
// if os.Getenv("TOMO_USE_ALUMINUM_STYLE") != "" { // if os.Getenv("TOMO_USE_ALUMINUM_STYLE") != "" {
// styl = aluminumStyle.New() // styl = aluminumStyle.New()
// } else { // } else {
styl = fallbackStyle.New() styl, _ = fallbackStyle.New()
// } // }
icons := fallbackIcons.New() icons := fallbackIcons.New()

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

Binary file not shown.

View File

@ -1,497 +0,0 @@
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.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")),
}

View File

@ -1,11 +1,541 @@
package fallbackStyle package fallbackStyle
import "io"
import "bytes"
import "image"
import _ "embed"
import _ "image/png"
import "image/color" import "image/color"
import "git.tebibyte.media/tomo/tomo" import "git.tebibyte.media/tomo/tomo"
import "golang.org/x/image/font/basicfont"
import "git.tebibyte.media/tomo/tomo/event"
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 }
//go:embed assets/atlas.png
var atlasBytes []byte
type closerCookie struct { io.Closer }
func (cookie closerCookie) Close () { cookie.Closer.Close() }
func newCloserCookie (closer io.Closer) event.Cookie {
return closerCookie { Closer: closer }
}
// New returns Wintergreen, the default Tomo style. It is neutral-gray with // New returns Wintergreen, the default Tomo style. It is neutral-gray with
// green and turquoise accents. // green and turquoise accents.
func New () *tomo.Style { func New () (*tomo.Style, event.Cookie) {
atlasImage, _, err := image.Decode(bytes.NewReader(atlasBytes))
if err != nil { panic(err) }
atlasTexture := tomo.NewTexture(atlasImage)
textureCheckboxChecked := atlasTexture.SubTexture(image.Rect( 0, 0, 12, 11))
textureCorkboard := atlasTexture.SubTexture(image.Rect(16, 0, 28, 12))
textureTearLine := atlasTexture.SubTexture(image.Rect(16, 12, 18, 13))
textureHandleVertical := atlasTexture.SubTexture(image.Rect(28, 0, 29, 2))
textureHandleHorizontal := atlasTexture.SubTexture(image.Rect(28, 0, 30, 1))
cookie := event.MultiCookie(newCloserCookie(atlasTexture))
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.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.ABorder (
outline,
tomo.Border {
Width: tomo.I(1, 0, 0, 1),
Color: borderColorEngraved,
}),
tomo.AColor(nil),
tomo.ATexture(textureCorkboard),
tomo.APadding(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.ABorder (
outline,
tomo.Border {
Width: tomo.I(1),
Color: borderColorFocused,
}),
tomo.APadding(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.ABorder (
outline,
tomo.Border {
Width: tomo.I(1),
Color: borderColorLifted,
},
tomo.Border {
Width: tomo.I(1),
Color: [4]color.Color {
tomo.ColorRaised, tomo.ColorRaised,
tomo.ColorRaised, tomo.ColorRaised,
},
}),
tomo.AColor(nil),
tomo.ATexture(textureHandleVertical),
tomo.AMinimumSize(12, 12),
), tomo.R("", "SliderHandle")),
// *.SliderHandle[horizontal]
tomo.Ru(tomo.AS (
tomo.ATexture(textureHandleHorizontal),
), tomo.R("", "SliderHandle"), "horizontal"),
// *.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(textureCheckboxChecked),
), 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.ABorder (
tomo.Border {
Width: tomo.I(3),
Color: [4]color.Color {
color.Transparent,
color.Transparent,
color.Transparent,
color.Transparent,
},
}),
tomo.ATexture(textureTearLine),
tomo.APadding(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")),
}
return &tomo.Style { return &tomo.Style {
Rules: rules, Rules: rules,
Colors: map[tomo.Color] color.Color { Colors: map[tomo.Color] color.Color {
@ -15,5 +545,5 @@ func New () *tomo.Style {
tomo.ColorSunken: colorCarved, tomo.ColorSunken: colorCarved,
tomo.ColorAccent: colorFocus, tomo.ColorAccent: colorFocus,
}, },
} }, cookie
} }