Documentation
¶
Overview ¶
Package apptheme is what every lys-shell GTK-era surface loads at start (bootstrap.rs, lys-settings app/css.rs): the Rust stylesheet bundle with its hot reload, the stylesheet font resolver, and the lys-shell icon registry on the icon search path.
Index ¶
- Constants
- func FollowDesktopFontSize(a *app.Application)
- func FontResolver(family string, weight int) (render.Font, bool)
- func InstallWidgetTheme(p *styling.Palette, cfg *config.Config)
- func Setup(a *app.Application) (stop func())
- func WidgetTheme(p *styling.Palette, cfg *config.Config) *widget.Theme
- type Theme
Constants ¶
const ComponentPriority = widget.StylePriorityUser + 200
ComponentPriority is a widget's own dynamic CSS - an album art or avatar background, a color swatch - above the bundle, so no bundle rule overrides it (wayle-styling's COMPONENT_CSS_PRIORITY, GTK priority 1000). A widget's plain inline style sits at user priority, under the bundle, as a GTK per-widget provider does.
const Priority = widget.StylePriorityUser + 100
Priority is the bundle's provider priority: bootstrap.rs loads it at STYLE_PROVIDER_PRIORITY_USER + 100, above the per-widget variable providers (STYLE_PROVIDER_PRIORITY_USER).
Variables ¶
This section is empty.
Functions ¶
func FollowDesktopFontSize ¶
func FollowDesktopFontSize(a *app.Application)
FollowDesktopFontSize makes 1rem what it is in a GTK app on this desktop - the desktop font's size, GTK's "Sans 10" without one - now and on every change: the bundle sizes its text in rem, and every Rust surface resolved it through GTK.
func FontResolver ¶
FontResolver resolves the stylesheet's font-family and font-weight declarations through the system font store, so the bundle's --weight-* tokens and a user's font-family take effect. A family the store lacks declines, keeping the label's own face.
func InstallWidgetTheme ¶
InstallWidgetTheme installs WidgetTheme(p, cfg) and, the first time, the shell's theme-level button rule.
func Setup ¶
func Setup(a *app.Application) (stop func())
Setup is the process-wide half of a surface's start: the stylesheet fonts resolve through the system store, rem follows the desktop font (FollowDesktopFontSize), and lys-shell's icons join the icon search path. The returned function stops the icons watch.
func WidgetTheme ¶
WidgetTheme is lys-ui's theme built from the resolved palette, so every lys-ui widget and named color (@window_bg_color, @accent_bg_color, @borders, ...) paints from the same colors as the shell's stylesheet: the palette's own slots where lys-ui has one, the design tokens where the shell derives the role (hover and pressed fills, elevated surfaces, borders), the status colors, the global rounding at the global scale, and the animation switch. What the palette does not cover (chart series, shadows) comes from lys-ui's dark or light theme, whichever the background is.
Types ¶
type Theme ¶
type Theme struct {
Sheet *widget.Stylesheet
// contains filtered or unexported fields
}
Theme owns the stylesheet: the bundle — the built-in CSS, the theme's :root variables, and the user's styles/index.css — attached to the roots that take it (the Go-painted surfaces keep their programmatic styling), plus the resolved palette the Go-painted surfaces read.
func New ¶
New resolves the palette, compiles the bundle and installs lys-ui's theme from the palette (WidgetTheme). A provider or user-stylesheet failure logs and falls back (the configured palette, no user CSS), the Rust shell's behavior.
func (*Theme) Attach ¶
func (t *Theme) Attach(root interface{ AttachStylesheet(*widget.Stylesheet) })
Attach styles one root.
func (*Theme) Bundle ¶
Bundle builds init_css_provider's CSS (bootstrap.rs): static, theme, the [animations] overrides (the --duration-* tokens and, with indicators off, the frozen looping animations), then user styles, resolving the palette on the way.
func (*Theme) Reload ¶
func (t *Theme) Reload()
Reload recompiles the bundle into the attached stylesheet and reinstalls lys-ui's theme: every root restyles on the next frame.
func (*Theme) RenderPalette ¶
RenderPalette is the resolved palette as render colors, for the surfaces the stylesheet does not reach (OSD, popups, dropdowns).
func (*Theme) WatchUserStyles ¶
func (t *Theme) WatchUserStyles(application *app.Application)
WatchUserStyles reloads the bundle when the user stylesheet changed: the styles directory is watched on the loop (app.WatchFiles), and the stamp filters out changes to other files. Without inotify it polls once a second. A failed read keeps the stylesheet running: UserCSS logs and contributes nothing.