style

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Overview

Package style is the single source of truth for Rune's non-interactive terminal styling. It maps semantic roles (error, warning, task name, …) to Lip Gloss styles so every output surface draws from one restrained palette.

The package never decides *whether* to colorize — that decision is made once per stream at the command boundary (cmd/rune) and passed in as the enabled flag. When disabled, every role is the zero Lip Gloss style, so Render returns its input unchanged and output is byte-for-byte identical to plain text.

Index

Constants

View Source
const (
	ColorError     = lipgloss.Color("1")   // red
	ColorWarning   = lipgloss.Color("3")   // yellow
	ColorSuccess   = lipgloss.Color("2")   // green
	ColorAccent    = lipgloss.Color("170") // task names, headings
	ColorMuted     = lipgloss.Color("245") // docs, echo, cache notices
	ColorMutedDark = lipgloss.Color("241") // picker key-hint line
)

Semantic palette, defined once and exported so every surface — including the interactive picker (internal/tui) — draws its color literals from here and the palettes cannot drift apart.

Variables

This section is empty.

Functions

This section is empty.

Types

type Theme

type Theme struct {
	Error    lipgloss.Style // error severity / failures
	Warning  lipgloss.Style // warning severity, cache-write warnings
	Success  lipgloss.Style // active/running accents
	TaskName lipgloss.Style // task identifiers in --list
	Heading  lipgloss.Style // group headers, help section titles
	Muted    lipgloss.Style // docs, command echo, cached/would-run notices
	Locator  lipgloss.Style // file:line:col emphasis in diagnostics
	Caret    lipgloss.Style // diagnostic caret span
}

Theme holds one Lip Gloss style per semantic role. The zero Theme is valid and renders every role as plain text (no ANSI), which is exactly the disabled state produced by New(false, …).

func New

func New(enabled bool, w io.Writer) Theme

New builds the theme for one output stream. When enabled is false it returns the zero Theme (all roles plain). When true, styles are bound to an explicit Lip Gloss renderer whose color profile is forced on, so color is emitted even when the stream is a pipe (honoring --color=always) rather than being silently stripped by termenv's TTY auto-detection.

Jump to

Keyboard shortcuts

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