ui

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

View Source
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.

View Source
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 Bytes

func Bytes(n int64) string

Bytes formats a byte count with binary units.

func FangColors

func FangColors(c lipgloss.LightDarkFunc) fang.ColorScheme

FangColors themes cobra help and errors with the brand palette.

func Fprint

func Fprint(w io.Writer, s string)

Fprint writes styled text, downsampling colors to what w supports and dropping them for pipes, files and NO_COLOR.

func IsTerminal

func IsTerminal(f any) bool

IsTerminal reports whether f is an interactive terminal. Character devices that are not terminals, such as /dev/null, are not.

func NewLogger

func NewLogger(w io.Writer, level string) (*slog.Logger, error)

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

func VerdictStyle(verdict string) lipgloss.Style

VerdictStyle returns the style for a staleness verdict.

Types

This section is empty.

Jump to

Keyboard shortcuts

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