style

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Package style is the only place in the CLI that decides what color something is. Callers never construct ANSI codes or reference a hex color directly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accent

func Accent(s string) string

func Dim

func Dim(s string) string

func Disable

func Disable()

func Enable

func Enable()

func EnableForTests

func EnableForTests()

Forces a real color profile so tests can assert on colored output, since go test has no terminal attached. Not for production code.

func Error

func Error(s string) string
func Header(s string) string
func Logo(width int) string

Width 0 means the terminal size is unknown (piped output) and falls back to the compact form: a wrapped logo reads as corruption.

func StatusColor

func StatusColor(value string) string

func Success

func Success(s string) string

func Warning

func Warning(s string) string

Types

type Palette

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

Renders at a fixed setting, so callers on different streams gate on their own — piping stdout must not strip color from a live stderr message.

func Default

func Default() Palette

Default reads the package gate at call time, not capture time, so Disable() still takes effect after flag parsing.

func NewPalette

func NewPalette(enabled bool) Palette

func (Palette) Accent

func (p Palette) Accent(s string) string

func (Palette) Dim

func (p Palette) Dim(s string) string

func (Palette) Error

func (p Palette) Error(s string) string

func (Palette) Header

func (p Palette) Header(s string) string

func (Palette) StatusColor

func (p Palette) StatusColor(value string) string

Leaves an unrecognised status unstyled rather than guessing. Exact-word match, so "proactive" cannot trigger on "active".

func (Palette) Success

func (p Palette) Success(s string) string

func (Palette) Warning

func (p Palette) Warning(s string) string

Jump to

Keyboard shortcuts

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