theme

package
v0.39.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package theme is the single home for the Volcano CLI color identity: the palette, the color-enable gate (NO_COLOR + real TTY), and the small string helpers commands use to style output. The interactive setup path and every resource command share it so the whole CLI reads as one product.

Every helper takes an explicit on bool and is a plain pass-through when off, so callers decide once (via On) whether the destination should get ANSI. Machine-read output (pipes, files, --json, CI, test buffers) stays plain.

Index

Constants

View Source
const (
	FlameHex      = "#f54019" // lava flame: key hints, suggested commands
	LavaHex       = "#f37a58" // lava-500 brand primary: titles, table headers, CTA
	Volcano400Hex = "#fb923c" // volcano-400: key-hint accent (space)
	VolcanoHex    = "#f97316" // volcano-500: success, active, installed
	Volcano600Hex = "#ea580c" // volcano-600: CTA example prompt, key-hint accent (enter)
	OutdatedHex   = "#eab308" // amber: warnings, pending/in-progress states
	GrayHex       = "#6b7280" // neutral gray: summaries, separators, dim detail
	FailedHex     = "#dc2626" // lava red: errors, failed states
)

The Volcano palette, taken from volcano-web. Kept as exported consts so the setup report (lipgloss styles) and any other caller reference one source.

Variables

This section is empty.

Functions

func Command

func Command(s string, on bool) string

Command styles a suggested command or key hint (flame).

func Dim

func Dim(s string, on bool) string

Dim styles summaries, separators, and detail labels (gray).

func Error

func Error(s string, on bool) string

Error styles an error prefix (red, bold).

func Fail

func Fail(s string, on bool) string

Fail styles failure value text (red, not bold) — the counterpart to Error's prefix for message bodies and failed inline values.

func On

func On(w io.Writer) bool

On reports whether ANSI styling should be written to w: only when w is a real interactive terminal and NO_COLOR is unset. Piped output, files, other character devices (e.g. /dev/null), and test buffers stay plain so machine-read output is never polluted with escape codes.

func Status

func Status(s string, on bool) string

Status colors a status/state word by meaning. The caller pads s to its column width FIRST so the ANSI codes never count toward the width and break table alignment; Status classifies on the trimmed word but renders the padded s.

func Success

func Success(s string, on bool) string

Success styles a success mark/line (volcano, bold).

func Title

func Title(s string, on bool) string

Title styles titles and table headers (lava, bold).

func Warn

func Warn(s string, on bool) string

Warn styles a warning prefix (amber).

func Width

func Width(w io.Writer) int

Width returns w's column count when it is a real terminal, else 0 (unknown, e.g. piped/file output).

Types

This section is empty.

Jump to

Keyboard shortcuts

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