theme

package
v0.0.0-...-9759625 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package theme holds the color palettes and lipgloss styles used across wrongtop: ten built-in palettes plus user-defined palettes loaded from ~/.config/wrongtop/themes/*.yml.

Index

Constants

This section is empty.

Variables

View Source
var (
	// GruvboxDark seeds the unset slots of user-defined palettes.
	GruvboxDark = Palette{
		Name:   "gruvbox-dark",
		BG:     "#282828",
		FG:     "#ebdbb2",
		Red:    "#fb4934",
		Green:  "#b8bb26",
		Yellow: "#fabd2f",
		Blue:   "#83a598",
		Purple: "#d3869b",
		Cyan:   "#8ec07c",
		Orange: "#fe8019",
		Gray:   "#928374",
	}

	CatppuccinMocha = Palette{
		Name:   "catppuccin-mocha",
		BG:     "#1e1e2e",
		FG:     "#cdd6f4",
		Red:    "#f38ba8",
		Green:  "#a6e3a1",
		Yellow: "#f9e2af",
		Blue:   "#89b4fa",
		Purple: "#cba6f7",
		Cyan:   "#94e2d5",
		Orange: "#fab387",
		Gray:   "#6c7086",
	}

	Dracula = Palette{
		Name:   "dracula",
		BG:     "#282a36",
		FG:     "#f8f8f2",
		Red:    "#ff5555",
		Green:  "#50fa7b",
		Yellow: "#f1fa8c",

		Blue:   "#ff79c6",
		Purple: "#bd93f9",
		Cyan:   "#8be9fd",
		Orange: "#ffb86c",
		Gray:   "#6272a4",
	}

	Nord = Palette{
		Name:   "nord",
		BG:     "#2e3440",
		FG:     "#eceff4",
		Red:    "#bf616a",
		Green:  "#a3be8c",
		Yellow: "#ebcb8b",
		Blue:   "#81a1c1",
		Purple: "#b48ead",
		Cyan:   "#88c0d0",
		Orange: "#d08770",
		Gray:   "#7b88a1",
	}

	TokyoNight = Palette{
		Name:   "tokyo-night",
		BG:     "#1a1b26",
		FG:     "#c0caf5",
		Red:    "#f7768e",
		Green:  "#9ece6a",
		Yellow: "#e0af68",
		Blue:   "#7aa2f7",
		Purple: "#bb9af7",
		Cyan:   "#7dcfff",
		Orange: "#ff9e64",
		Gray:   "#565f89",
	}

	SolarizedDark = Palette{
		Name:   "solarized-dark",
		BG:     "#002b36",
		FG:     "#eee8d5",
		Red:    "#dc322f",
		Green:  "#859900",
		Yellow: "#b58900",
		Blue:   "#268bd2",
		Purple: "#d33682",
		Cyan:   "#2aa198",
		Orange: "#cb4b16",
		Gray:   "#93a1a1",
	}

	OneDark = Palette{
		Name:   "one-dark",
		BG:     "#282c34",
		FG:     "#abb2bf",
		Red:    "#e06c75",
		Green:  "#98c379",
		Yellow: "#e5c07b",
		Blue:   "#61afef",
		Purple: "#c678dd",
		Cyan:   "#56b6c2",
		Orange: "#d19a66",
		Gray:   "#5c6370",
	}

	RosePine = Palette{
		Name:   "rose-pine",
		BG:     "#191724",
		FG:     "#e0def4",
		Red:    "#eb6f92",
		Green:  "#31748f",
		Yellow: "#f6c177",
		Blue:   "#9ccfd8",
		Purple: "#c4a7e7",
		Cyan:   "#ebbcba",

		Orange: "#d7827e",
		Gray:   "#6e6a86",
	}

	EverforestDark = Palette{
		Name:   "everforest-dark",
		BG:     "#2f383e",
		FG:     "#d3c6aa",
		Red:    "#e67e80",
		Green:  "#a7c080",
		Yellow: "#dbbc7f",
		Blue:   "#7fbbb3",
		Purple: "#d699b6",
		Cyan:   "#83c092",
		Orange: "#e69875",
		Gray:   "#9da9a0",
	}

	Kanagawa = Palette{
		Name:   "kanagawa",
		BG:     "#1f1f28",
		FG:     "#dcd7ba",
		Red:    "#e46876",
		Green:  "#98bb6c",
		Yellow: "#c0a36e",
		Blue:   "#7e9cd8",
		Purple: "#957fb8",
		Cyan:   "#7aa89f",
		Orange: "#ffa066",
		Gray:   "#727169",
	}
)

Built-in palettes.

Functions

func LoadUserThemes

func LoadUserThemes(dir string) error

LoadUserThemes (re)reads every *.yml file in dir into the user palette registry. Files whose name does not start with '#' inherit the file name as the palette name; incomplete colors fall back to the default palette for that slot.

func Names

func Names() []string

Names lists every selectable theme: built-ins first, then user themes alphabetically.

func PaletteNames

func PaletteNames() []string

PaletteNames lists the built-in palette names in display order.

func ThemesDir

func ThemesDir() string

ThemesDir returns the directory user theme files are loaded from: ~/.config/wrongtop/themes.

Types

type Palette

type Palette struct {
	Name string
	BG   string
	FG   string

	Red    string
	Green  string
	Yellow string
	Blue   string
	Purple string
	Cyan   string
	Orange string
	Gray   string
}

Palette is a named set of terminal colors.

func Resolve

func Resolve(name string) (Palette, bool)

Resolve finds a palette by name: user themes first (so a file can override a built-in), then the built-in registry, else the default.

type Ramps

type Ramps struct {
	CPU  canvas.Ramp // utilization, low → high: green → yellow → orange → red
	Mem  canvas.Ramp // memory pressure: blue → purple → red
	Swap canvas.Ramp // swap usage: purple → red
	IO   canvas.Ramp // disk activity: cyan → green → yellow → red
	Bat  canvas.Ramp // battery, empty → full: red → orange → green
	Load canvas.Ramp // load average: cyan → green
	RX   canvas.Ramp // download share of the mixed meters: green → cyan
	TX   canvas.Ramp // upload share of the mixed meters: blue → cyan
}

Ramps groups the value→color gradients shared by every tab, derived from the palette so a metric reads the same wherever it appears.

type Styles

type Styles struct {
	TabBar      lipgloss.Style
	TabActive   lipgloss.Style
	TabInactive lipgloss.Style
	Status      lipgloss.Style
	Title       lipgloss.Style
	FG          lipgloss.Style // plain readable text: never left to the terminal default
	HelpKey     lipgloss.Style
	HelpText    lipgloss.Style
	OK          lipgloss.Style
	Warn        lipgloss.Style
	Crit        lipgloss.Style
	Muted       lipgloss.Style
	Track       lipgloss.Style // the empty run of a meter: fainter than Muted text
	Border      lipgloss.Style
	BorderChar  lipgloss.Style
	BorderTitle lipgloss.Style
	Selected    lipgloss.Style // focused row of the data tables
}

Styles are the shared lipgloss styles derived from a palette.

type Theme

type Theme struct {
	Palette Palette
	Styles  Styles
	Ramps   Ramps
}

Theme pairs a palette with the derived lipgloss styles.

func ByName

func ByName(name string) *Theme

ByName resolves a theme by name, falling back to the default (tokyo-night, matching config.Default).

func New

func New(p Palette) *Theme

New derives a full theme from a palette.

func (*Theme) Soft

func (t *Theme) Soft(hex string) string

Soft blends a palette color toward the panel background — solid primary colors read harsh in large fills, so chips, active tabs and alert strips use this muted mix instead (modern soft-UI look).

func (*Theme) Value

func (t *Theme) Value(warn, crit, pct float64) lipgloss.Style

Value colors a percentage according to the configured thresholds.

Jump to

Keyboard shortcuts

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