42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package gel
|
|
|
|
import (
|
|
"gioui.org/font"
|
|
"gioui.org/text"
|
|
"gioui.org/unit"
|
|
"git.mleku.dev/mleku/prevara/pkg/opts/binary"
|
|
"git.mleku.dev/mleku/prevara/pkg/qu"
|
|
)
|
|
|
|
// Theme contains the styling configuration for gel widgets including colors,
|
|
// fonts, text sizing, and icon caching. It provides factory methods for creating
|
|
// themed widgets and manages the visual appearance of the user interface.
|
|
type Theme struct {
|
|
quit qu.C
|
|
shaper *text.Shaper
|
|
collection Collection
|
|
TextSize unit.Sp
|
|
*Colors
|
|
icons map[string]*Icon
|
|
scrollBarSize int
|
|
Dark *binary.Opt
|
|
iconCache IconCache
|
|
WidgetPool *Pool
|
|
}
|
|
|
|
// NewTheme creates a new theme to use for rendering a user interface
|
|
func NewTheme(dark *binary.Opt, fontCollection []font.FontFace, quit qu.C) (th *Theme) {
|
|
textSize := GetScaledTextSize(unit.Sp(16))
|
|
th = &Theme{
|
|
quit: quit,
|
|
shaper: text.NewShaper(text.NoSystemFonts(), text.WithCollection(fontCollection)),
|
|
collection: fontCollection,
|
|
TextSize: textSize,
|
|
Colors: newColors(),
|
|
scrollBarSize: 0,
|
|
iconCache: make(IconCache),
|
|
}
|
|
th.SetDarkTheme(dark.True())
|
|
return
|
|
}
|