Documentation
¶
Overview ¶
Package ui holds every terminal style strata uses, built from the brand palette with adaptive colors that read on light and dark terminals, and the slog setup. Commands import styles from here; nothing defines colors inline.
Machine output (json, csv, ndjson, mermaid, dot, svg, html) is never styled; only table and tree output go through these styles, and colors are dropped automatically when stdout is not a terminal or NO_COLOR is set.
Index ¶
- Variables
- func Bytes(n int64) string
- func FangColors(c lipgloss.LightDarkFunc) fang.ColorScheme
- func Fprint(w io.Writer, s string)
- func IsTerminal(f any) bool
- func NewLogger(w io.Writer, level string) (*slog.Logger, error)
- func Profile(w io.Writer) colorprofile.Profile
- func VerdictStyle(verdict string) lipgloss.Style
Constants ¶
This section is empty.
Variables ¶
var ( Brand = compat.AdaptiveColor{Light: lipgloss.Color("#5B47D6"), Dark: lipgloss.Color("#A99BFF")} Muted = compat.AdaptiveColor{Light: lipgloss.Color("#6B6880"), Dark: lipgloss.Color("#8E8AA6")} Text = compat.AdaptiveColor{Light: lipgloss.Color("#1D1A2E"), Dark: lipgloss.Color("#E9E6F5")} Fresh = compat.AdaptiveColor{Light: lipgloss.Color("#1E8A55"), Dark: lipgloss.Color("#5FD39A")} Drifting = compat.AdaptiveColor{Light: lipgloss.Color("#9A7B00"), Dark: lipgloss.Color("#E8C84A")} Stale = compat.AdaptiveColor{Light: lipgloss.Color("#C2451B"), Dark: lipgloss.Color("#F08A5D")} Abandoned = compat.AdaptiveColor{Light: lipgloss.Color("#6E6E78"), Dark: lipgloss.Color("#A3A3AD")} Conflict = compat.AdaptiveColor{Light: lipgloss.Color("#C8243B"), Dark: lipgloss.Color("#FF6B81")} )
Brand palette. Violet is the one color that means strata; the verdict colors each have one job.
var ( Title = lipgloss.NewStyle().Bold(true).Foreground(Brand) Header = lipgloss.NewStyle().Bold(true).Foreground(Muted) Label = lipgloss.NewStyle().Foreground(Text) Dim = lipgloss.NewStyle().Foreground(Muted) Key = lipgloss.NewStyle().Foreground(Brand) Branch = lipgloss.NewStyle().Foreground(Muted) Warning = lipgloss.NewStyle().Foreground(Stale) Bad = lipgloss.NewStyle().Foreground(Conflict) )
Styles used across commands.
Functions ¶
func FangColors ¶
func FangColors(c lipgloss.LightDarkFunc) fang.ColorScheme
FangColors themes cobra help and errors with the brand palette.
func Fprint ¶
Fprint writes styled text, downsampling colors to what w supports and dropping them for pipes, files and NO_COLOR.
func IsTerminal ¶
IsTerminal reports whether f is an interactive terminal. Character devices that are not terminals, such as /dev/null, are not.
func NewLogger ¶
NewLogger returns a slog logger that writes human-friendly logs through charmbracelet/log to w. level is debug, info, warn or error.
func Profile ¶
func Profile(w io.Writer) colorprofile.Profile
Profile returns the color profile for w.
func VerdictStyle ¶
VerdictStyle returns the style for a staleness verdict.
Types ¶
This section is empty.