ui

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 8 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 cchp's one restrained palette. It uses the terminal's own ANSI colors, so it follows light and dark themes, and output written through Writer drops color for NO_COLOR, dumb terminals and pipes.

Index

Constants

This section is empty.

Variables

View Source
var (
	Accent  = lipgloss.Color("4")
	Good    = lipgloss.Color("2")
	Bad     = lipgloss.Color("1")
	Caution = lipgloss.Color("3")
)
View Source
var (
	Title    = lipgloss.NewStyle().Bold(true)
	Brand    = lipgloss.NewStyle().Bold(true).Foreground(Accent)
	Muted    = lipgloss.NewStyle().Faint(true)
	Key      = lipgloss.NewStyle().Bold(true)
	Success  = lipgloss.NewStyle().Foreground(Good)
	Failure  = lipgloss.NewStyle().Foreground(Bad).Bold(true)
	Warning  = lipgloss.NewStyle().Foreground(Caution)
	Selected = lipgloss.NewStyle().Foreground(Accent).Bold(true)
	Box      = lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).BorderForeground(Accent).Padding(0, 1)
	AlertBox = lipgloss.NewStyle().Border(lipgloss.RoundedBorder()).BorderForeground(Caution).Padding(0, 1)
)

Functions

func Sentence

func Sentence(text string) string

Sentence starts text with a capital letter for people to read. The program name keeps its lower case.

func TerminalWidth

func TerminalWidth(f *os.File) int

TerminalWidth is the width of the terminal behind f, or 0 when f is not one.

func Wrap

func Wrap(text string, width, indent int) string

Wrap breaks text at word boundaries to fit width columns and indents every line after the first by indent spaces.

func Writer

func Writer(w io.Writer) io.Writer

Writer wraps w so styled text is downgraded to what the terminal supports, with no color at all for NO_COLOR or when w is not a terminal.

Types

This section is empty.

Jump to

Keyboard shortcuts

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