theme

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package theme carries the design tokens a component reads while it lays out. A Theme is one rx.Observable per token category — colour, type, motion, spacing, radius, elevation — so a consumer subscribes to only the categories it actually reads and rebuilds only when those change.

Reach for it whenever you build an observable prism component: button.Button, input.TextField and their siblings all take an rx.Observable[theme.Theme] as their first argument, and a window that emits a new Theme follows the appearance change with no application code. Default() returns a static light theme, emitted once, which is what tests and static rendering want.

Two assumptions are worth knowing. Theme is a plain struct of observables and owns no state, so a Theme you assemble field by field must have every field set — a missing one is a nil observable, not a default. And AutoLightDark() reads the wall clock, not the OS: hours 7 through 17 are light and the rest dark. For real OS appearance and accent tracking use spectrum's system.LiveTheme instead.

This package is the home of the theme contract since it moved down from github.com/vibrantgio/prism, so that the theme runtime sits beneath the components it themes; aliases keep the old import path working. See the repository README.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoLightDark

func AutoLightDark() rx.Observable[Theme]

AutoLightDark returns an Observable that emits a new Theme every minute. Hours 7–17 (inclusive) use DefaultLight; all other hours use DefaultDark.

Types

type Theme

Theme carries an rx.Observable for each token category. Consumers subscribe to the fields they need and react to updates without polling.

func Default

func Default() Theme

Default returns a Theme whose every field emits the package-level default value once and then completes. It is the canonical starting point for static or test scenarios that do not need live token switching.

Jump to

Keyboard shortcuts

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