palette

package
v0.26.0 Latest Latest
Warning

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

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

Documentation

Overview

Package palette holds the named color roles for dotdrift's colored CLI output and their per-profile overrides.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Palette

type Palette struct {
	// contains filtered or unexported fields
}

Palette maps roles to raw SGR parameter sequences (no ESC/CSI wrapper).

func Default

func Default() *Palette

Default returns the built-in palette. Missing stays orange (38;5;208) — the light-red experiment was reverted; orange keeps missing visually distinct from hard failures (error red) while reading as "absent, not broken".

func FromConfig

func FromConfig(cfg map[string]string) (*Palette, error)

FromConfig builds a palette from [colors] overrides (role → raw SGR params). Unknown roles and malformed values are errors — a typo must fail loudly at dotdrift.toml load, never silently keep the default.

func (*Palette) BoldSeq

func (p *Palette) BoldSeq(r Role) string

BoldSeq returns the bold variant of a role's sequence ("1;" prefix).

func (*Palette) Seq

func (p *Palette) Seq(r Role) string

Seq returns the raw SGR parameters for a role (digits only, no wrapper).

func (*Palette) Wrap

func (p *Palette) Wrap(r Role, s string) string

Wrap renders s in the role's hue (full escape sequence).

type Role

type Role string

Role is one named color slot. The vocabulary is shared by status, modules, plan, and diff output.

const (
	OK      Role = "ok"      // all-checks-passed, no-drift
	Missing Role = "missing" // missing/removed items (light red)
	Warn    Role = "warn"    // content/version differs (yellow)
	Error   Role = "error"   // unknown, not-a-symlink (red)
	Orphan  Role = "orphan"  // orphans section (magenta)
	Dim     Role = "dim"     // dimmed module/description text
)

Jump to

Keyboard shortcuts

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