apptheme

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const ComponentPriority = widget.StylePriorityUser + 200

ComponentPriority is a widget's own dynamic CSS - an album art or avatar background - 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.

View Source
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

func FontResolver(family string, weight int) (render.Font, bool)

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

func InstallWidgetTheme(p *styling.Palette, cfg *config.Config)

InstallWidgetTheme installs WidgetTheme(p, cfg) and, the first time, the shell's theme-level button rule.

func ReportMissingIcons added in v0.2.0

func ReportMissingIcons(cfg *config.Config, sink config.DiagnosticSink)

ReportMissingIcons sends sink a warning for each lys-shell icon cfg names that the icon theme Setup joined does not provide.

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

func WidgetTheme(p *styling.Palette, cfg *config.Config) *widget.Theme

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

func New(cfg *config.Config) *Theme

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

func (t *Theme) Bundle() string

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

func (t *Theme) RenderPalette() *styling.Palette

RenderPalette is the resolved palette as render colors, for the surfaces the stylesheet does not reach (OSD, popups, dropdowns).

func (*Theme) SetConfig

func (t *Theme) SetConfig(cfg *config.Config)

SetConfig recompiles the bundle for a new config snapshot.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL