ui

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package ui provides shared styling for the Truestamp CLI using lipgloss v2. Colors are sourced from the Catppuccin palette (Latte for light terminals, Mocha for dark). The same palette is used for both static lipgloss output and interactive huh components via HuhTheme().

IMPORTANT: Color initialization is deferred to Init() to avoid terminal queries at package init time. Querying the terminal (for dark/light background detection) in a background process group causes SIGTTIN, which hangs shell completion via source <(truestamp completion zsh).

Index

Constants

This section is empty.

Variables

View Source
var (
	Green  color.Color = catppuccin.Mocha.Green()
	Red    color.Color = catppuccin.Mocha.Red()
	Yellow color.Color = catppuccin.Mocha.Yellow()
	Blue   color.Color = catppuccin.Mocha.Blue()
	Accent color.Color = catppuccin.Mocha.Mauve()
	Dim    color.Color = catppuccin.Mocha.Overlay0()
	Label  color.Color = catppuccin.Mocha.Subtext0()
	Value  color.Color = catppuccin.Mocha.Text()
)

Color variables. Defaults to dark (Mocha) palette. Updated by Init() if the terminal has a light background.

Functions

func AccentBoldStyle

func AccentBoldStyle() lipgloss.Style

AccentBoldStyle returns a bold accent-colored style.

func FailureBanner

func FailureBanner(text string) string

FailureBanner renders a bold red failure message.

func FaintStyle

func FaintStyle() lipgloss.Style

FaintStyle returns a faint/dim style.

func HeaderBox

func HeaderBox(title, subtitle string) string

HeaderBox renders a bordered title box with an optional subtitle.

func HuhTheme

func HuhTheme() huh.Theme

HuhTheme returns the Catppuccin theme for huh interactive components. Uses the same Latte/Mocha palette as the static color definitions above.

func Init

func Init(noColor bool)

Init configures the global color profile and detects the terminal's background color. Call once from root command before any output. If noColor is true, all ANSI sequences are stripped. The NO_COLOR env var is handled automatically by lipgloss.

func LabelStyle

func LabelStyle() lipgloss.Style

LabelStyle returns the style for key-value labels.

func SectionHeader

func SectionHeader(name string) string

SectionHeader renders a styled group header with a separator line.

func SuccessBanner

func SuccessBanner(text string) string

SuccessBanner renders a bold green success message.

func ValueStyle

func ValueStyle() lipgloss.Style

ValueStyle returns the style for key-value values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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