appearance

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 4 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 appearance holds the desktop's presentation preferences as xdg-desktop-portal publishes them: the color scheme, the accent color and the contrast level. An app.Application reads them and reports changes on its loop goroutine; lys-ui never applies them on its own.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accent

type Accent struct {
	R, G, B float64
	Known   bool
}

Accent is the desktop's accent-color preference: RGB components in [0, 1], with Known set when the desktop published one.

func (Accent) Color

func (a Accent) Color() (render.Color, bool)

Color returns the accent as an opaque render.Color, and false when the desktop published none.

type ColorScheme

type ColorScheme uint8

ColorScheme is the desktop's dark/light preference.

const (
	// Unknown means no portal, no preference, or a value outside the
	// spec. It is a reason to keep the current theme.
	Unknown ColorScheme = iota
	// Dark means the desktop prefers a dark style.
	Dark
	// Light means the desktop prefers a light style.
	Light
)

func (ColorScheme) String

func (s ColorScheme) String() string

String returns "dark", "light" or "unknown".

type Contrast

type Contrast uint8

Contrast is the desktop's contrast preference.

const (
	// ContrastUnknown is no preference, no portal, or an unreadable
	// value.
	ContrastUnknown Contrast = iota
	// ContrastHigh asks for the high-contrast presentation
	// (widget.HighContrastTheme).
	ContrastHigh
)

type FontSettings

type FontSettings struct {
	Font string
	DPI  float64
}

FontSettings is where a GTK app takes its default font size from: the desktop font description (gtk-font-name, "" when unset) and the text DPI (gtk-xft-dpi in dots per inch, 0 when unset).

func ResolveFontSettings

func ResolveFontSettings(portalFont string, portalTextScale float64, iniFont string, iniDPI float64) FontSettings

ResolveFontSettings applies GTK's per-key precedence on Wayland: the portal's org.gnome.desktop.interface value when it published one (font-name; text-scaling-factor, as gtk-xft-dpi = 96 x the factor), else settings.ini's (gtk-font-name, gtk-xft-dpi). Unset inputs are "" and 0.

func (FontSettings) DefaultFontPx

func (s FontSettings) DefaultFontPx() float64

DefaultFontPx is the default font size, in logical pixels, a GTK app with these settings uses - what its 1rem is (gtk_css_font_size_get_default_px): an absolute size as given, a point size at the DPI. An unset or sizeless font is GTK's "Sans 10", an unset DPI 96.

type FontSize

type FontSize struct {
	Value  float64
	Pixels bool
}

FontSize is the size a Pango font description names: points, or absolute logical pixels when it ends in "px".

func ParseFontSize

func ParseFontSize(desc string) (FontSize, bool)

ParseFontSize reads the size of a Pango font description ("Adwaita Sans 11", "Sans Bold 10.5", "Monospace 12px", "Cantarell 11 @wght=500"); false when the description names no positive size.

type Motion added in v0.2.1

type Motion uint8

Motion is the desktop's reduced-motion preference.

const (
	// MotionUnknown is no preference, no portal, or an unreadable value.
	MotionUnknown Motion = iota
	// MotionReduced asks for things not to move: surfaces fade, and
	// nothing slides, bounces or scrolls smoothly.
	MotionReduced
)

Jump to

Keyboard shortcuts

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