Compare commits

..

No commits in common. "3127aad09a3a2d07a8f01e84cec2119c8c991b22" and "98fb8a3e014afc42119278aac0c32739167e45c3" have entirely different histories.

3 changed files with 54 additions and 55 deletions

View File

@ -7,7 +7,6 @@ import _ "image/png"
import "git.tebibyte.media/tomo/tomo"
import "git.tebibyte.media/tomo/tomo/data"
import "git.tebibyte.media/tomo/tomo/canvas"
import "git.tebibyte.media/tomo/backend/style"
//go:embed assets/icons-small.png
var atlasSmallBytes []byte
@ -418,7 +417,7 @@ type iconTheme struct {
}
// New creates a new fallback icon theme.
func New () style.IconSet {
func New () tomo.IconSet {
return new(iconTheme)
}

View File

@ -8,20 +8,19 @@ import "regexp"
import "strings"
import _ "image/png"
import "git.tebibyte.media/tomo/tomo"
import xdgIconTheme "git.tebibyte.media/tomo/xdg/icon-theme"
import "git.tebibyte.media/tomo/tomo/data"
import "git.tebibyte.media/tomo/tomo/canvas"
import "git.tebibyte.media/tomo/backend/style"
import xdgIconTheme "git.tebibyte.media/tomo/xdg/icon-theme"
type iconTheme struct {
xdg xdgIconTheme.Theme
fallback style.IconSet
fallback tomo.IconSet
texturesSmall map[tomo.Icon] canvas.Texture
texturesMedium map[tomo.Icon] canvas.Texture
texturesLarge map[tomo.Icon] canvas.Texture
}
func FindThemeWarn (name string, fallback style.IconSet, path ...string) (style.IconSet, error) {
func FindThemeWarn (name string, fallback tomo.IconSet, path ...string) (tomo.IconSet, error) {
this := &iconTheme {
fallback: fallback,
texturesLarge: make(map[tomo.Icon] canvas.Texture),

View File

@ -7,8 +7,8 @@ import _ "embed"
import _ "image/png"
import "image/color"
import "git.tebibyte.media/tomo/tomo"
import "golang.org/x/image/font/basicfont"
import "git.tebibyte.media/tomo/tomo/event"
import "git.tebibyte.media/tomo/backend/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 }
@ -55,7 +55,7 @@ func newCloserCookie (closer io.Closer) event.Cookie {
// New returns Wintergreen, the default Tomo style. It is neutral-gray with
// green and turquoise accents.
func New () (*style.Style, event.Cookie) {
func New () (*tomo.Style, event.Cookie) {
atlasImage, _, err := image.Decode(bytes.NewReader(atlasBytes))
if err != nil { panic(err) }
atlasTexture := tomo.NewTexture(atlasImage)
@ -68,16 +68,17 @@ func New () (*style.Style, event.Cookie) {
cookie := event.MultiCookie(newCloserCookie(atlasTexture))
rules := []style.Rule {
rules := []tomo.Rule {
// *.*
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AFace (basicfont.Face7x13 ),
tomo.ATextColor (tomo.ColorForeground),
tomo.ADotColor (tomo.ColorAccent ),
tomo.AGap (8, 8 ),
), tomo.R("", "")),
// *.Button
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
@ -90,7 +91,7 @@ rules := []style.Rule {
), tomo.R("", "Button")),
// *.Button[focused]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
@ -101,7 +102,7 @@ rules := []style.Rule {
), tomo.R("", "Button"), "focused"),
// *.Button[pressed]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
@ -114,7 +115,7 @@ rules := []style.Rule {
), tomo.R("", "Button"), "pressed"),
// *.TextInput
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.ABorder (
outline,
tomo.Border {
@ -126,7 +127,7 @@ rules := []style.Rule {
), tomo.R("", "TextInput")),
// *.TextInput[focused]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.ABorder (
outline,
tomo.Border {
@ -136,7 +137,7 @@ rules := []style.Rule {
), tomo.R("", "TextInput"), "focused"),
// *.TextView
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.ABorder (
outline,
tomo.Border {
@ -148,12 +149,12 @@ rules := []style.Rule {
), tomo.R("", "TextView")),
// *.NumberInput
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AGap(0, 0),
), tomo.R("", "NumberInput")),
// *.Container[sunken]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.ABorder (
outline,
tomo.Border {
@ -166,13 +167,13 @@ rules := []style.Rule {
), tomo.R("", "Container"), "sunken"),
// *.Container[outer]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrColor { Color: tomo.ColorBackground },
tomo.AttrPadding(tomo.I(8)),
), tomo.R("", "Container"), "outer"),
// *.Container[menu]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
@ -185,12 +186,12 @@ rules := []style.Rule {
), tomo.R("", "Container"), "menu"),
// *.Heading
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AAlign(tomo.AlignMiddle, tomo.AlignMiddle),
), tomo.R("", "Heading")),
// *.Separator
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(1),
@ -200,7 +201,7 @@ rules := []style.Rule {
), tomo.R("", "Separator")),
// *.Slider
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
@ -213,7 +214,7 @@ rules := []style.Rule {
), tomo.R("", "Slider")),
// *.Slider[focused]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.ABorder (
outline,
tomo.Border {
@ -224,17 +225,17 @@ rules := []style.Rule {
), tomo.R("", "Slider"), "focused"),
// *.Slider[horizontal]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AMinimumSize(48, 0),
), tomo.R("", "Slider"), "horizontal"),
// *.Slider[vertical]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AMinimumSize(0, 48),
), tomo.R("", "Slider"), "vertical"),
// *.SliderHandle
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.ABorder (
outline,
tomo.Border {
@ -254,17 +255,17 @@ rules := []style.Rule {
), tomo.R("", "SliderHandle")),
// *.SliderHandle[horizontal]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.ATexture(textureHandleHorizontal),
), tomo.R("", "SliderHandle"), "horizontal"),
// *.ScrollContainer
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AGap(0, 0),
), tomo.R("", "ScrollContainer")),
// *.Checkbox
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.ABorder (
outline,
tomo.Border {
@ -279,7 +280,7 @@ rules := []style.Rule {
), tomo.R("", "Checkbox")),
// *.Checkbox[focused]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.ABorder (
outline,
tomo.Border {
@ -290,39 +291,39 @@ rules := []style.Rule {
), tomo.R("", "Checkbox"), "focused"),
// *.Checkbox[checked]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.ATexture(textureCheckboxChecked),
), tomo.R("", "Checkbox"), "checked"),
// *.MenuItem
style.Ru(style.AS (
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]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrColor { Color: tomo.ColorAccent },
), tomo.R("", "MenuItem"), "focused"),
// *.MenuItem[hovered]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrColor { Color: tomo.ColorAccent },
), tomo.R("", "MenuItem"), "hovered"),
// *.File
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrColor { Color: color.Transparent },
), tomo.R("", "File")),
// *.File[focused]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrColor { Color: tomo.ColorAccent },
), tomo.R("", "File"), "focused"),
// *.TearLine
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.ABorder (
tomo.Border {
Width: tomo.I(3),
@ -338,7 +339,7 @@ rules := []style.Rule {
), tomo.R("", "TearLine")),
// *.TearLine[focused]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(3),
@ -348,7 +349,7 @@ rules := []style.Rule {
), tomo.R("", "TearLine"), "focused"),
// *.TearLine[hovered]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(3),
@ -358,7 +359,7 @@ rules := []style.Rule {
), tomo.R("", "TearLine"), "hovered"),
// *.Calendar
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(0, 1, 1, 0),
@ -372,37 +373,37 @@ rules := []style.Rule {
), tomo.R("", "Calendar")),
// *.CalendarGrid
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrGap { X: 2, Y: 2 },
), tomo.R("", "CalendarGrid")),
// *.CalendarWeekdayHeader
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrPadding(tomo.I(2)),
tomo.AttrColor { Color: colorCalendarWeekdayHeader },
), tomo.R("", "CalendarWeekdayHeader")),
// *.CalendarDay[weekday]
style.Ru(style.AS (
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]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrPadding(tomo.I(2)),
tomo.AttrMinimumSize { X: 32, Y: 32 },
tomo.AttrColor { Color: colorCalendarWeekend },
), tomo.R("", "CalendarDay"), "weekend"),
// *.TabbedContainer
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AGap(0, 0),
), tomo.R("", "TabbedContainer")),
// *.TabRow
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(1, 1, 0, 1),
@ -419,7 +420,7 @@ rules := []style.Rule {
), tomo.R("", "TabRow")),
// *.TabSpacer[left]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(0, 0, 1, 0),
@ -434,7 +435,7 @@ rules := []style.Rule {
), tomo.R("", "TabSpacer")),
// *.TabSpacer[right]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(1, 0, 0, 0),
@ -460,7 +461,7 @@ rules := []style.Rule {
), tomo.R("", "TabSpacer"), "right"),
// *.Tab
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(1, 0, 0, 0),
@ -487,7 +488,7 @@ rules := []style.Rule {
), tomo.R("", "Tab")),
// *.Tab[active]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
tomo.Border {
Width: tomo.I(1, 0, 0, 1),
@ -503,7 +504,7 @@ rules := []style.Rule {
), tomo.R("", "Tab"), "active"),
// *.Swatch
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
},
@ -511,7 +512,7 @@ rules := []style.Rule {
), tomo.R("", "Swatch")),
// *.Swatch[focused]
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
@ -522,7 +523,7 @@ rules := []style.Rule {
), tomo.R("", "Swatch"), "focused"),
// *.ColorPickerMap
style.Ru(style.AS (
tomo.Ru(tomo.AS (
tomo.AttrBorder {
outline,
tomo.Border {
@ -535,7 +536,7 @@ rules := []style.Rule {
), tomo.R("", "ColorPickerMap")),
}
return &style.Style {
return &tomo.Style {
Rules: rules,
Colors: map[tomo.Color] color.Color {
tomo.ColorBackground: colorBackground,