theme

package
v0.0.1-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package theme models lumos theme bundles and loads them from a zip archive (the distributable form) or a directory (handy for authoring).

A bundle contains a theme.yaml manifest with the theme's metadata and variants (each a named palette), plus a programs/ directory in which each file is the config/template for one program. The manifest does not list programs — they are discovered from the files, and each file's name (minus extension) is the registry port key. Files may use ${color.KEY} tokens, filled from the active variant's palette at apply time.

Index

Constants

View Source
const Manifest = "theme.yaml"

Manifest is the per-bundle metadata file.

View Source
const ProgramsDir = "programs"

ProgramsDir is the bundle subdirectory holding per-program config files.

Variables

This section is empty.

Functions

func Slugify

func Slugify(s string) string

Slugify lowercases s and replaces spaces/underscores with hyphens.

Types

type Program

type Program struct {
	// Port is the registry key, taken from the file name without extension.
	Port string
	// Template is the file body; ${color.KEY} tokens are filled per variant.
	Template string
}

Program is one program's config template, discovered from a bundle file.

type Theme

type Theme struct {
	Name        string
	Slug        string
	Family      string
	Source      string
	Description string
	Variants    []Variant
	Programs    []Program
	// Path is the bundle's zip file or directory.
	Path string
}

Theme is a loaded bundle.

func Discover

func Discover(dir string) ([]Theme, error)

Discover loads every theme bundle directly under dir: each .zip file, and each subdirectory containing a manifest. Results are sorted by slug. A missing dir yields no themes and no error.

func Load

func Load(path string) (Theme, error)

Load reads the bundle at path, which may be a .zip file or a directory.

func (Theme) DefaultVariant

func (t Theme) DefaultVariant() Variant

DefaultVariant returns the first variant.

func (Theme) Program

func (t Theme) Program(port string) (Program, bool)

Program returns the program for the given port.

func (Theme) Variant

func (t Theme) Variant(id string) (Variant, bool)

Variant returns the variant with the given id.

type Variant

type Variant struct {
	ID     string            `yaml:"id"`
	Name   string            `yaml:"name"`
	Style  string            `yaml:"style"`
	Colors map[string]string `yaml:"colors"`
}

Variant is one flavour of a theme with its own palette.

Jump to

Keyboard shortcuts

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