style

package
v0.265.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 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 style centralizes the lipgloss palette and reusable styles. All values are derived from the active theme.Theme and can be swapped at runtime via Apply — this is what powers live theme switching in the TUI. Existing callers reference the package-level vars directly; Apply reassigns them.

Index

Constants

View Source
const (
	IconCheck    = "✓"
	IconCross    = "✗"
	IconBullet   = "•"
	IconArrow    = "→"
	IconCaret    = "❯"
	IconDot      = "●"
	IconCircle   = "○"
	IconStore    = "▣"
	IconModel    = "◈"
	IconTuple    = "≡"
	IconChange   = "⇅"
	IconQuery    = "?"
	IconAssert   = "✦"
	IconGear     = "✱"
	IconSpark    = "✦"
	EdgeDirect   = "←"
	EdgeComputed = "="
	EdgeTTU      = "⇡"
)

Icons used across the CLI and TUI (Crush-inspired).

Variables

View Source
var (
	Primary     color.Color
	Secondary   color.Color
	Accent      color.Color
	Keyword     color.Color
	Violet      color.Color // second accent: mode chips, dialog borders/titles
	Magenta     color.Color // second accent: selection + palette highlights
	Fg          color.Color
	Muted       color.Color
	Faintc      color.Color
	BgBase      color.Color
	BgPanel     color.Color // sidebar column
	BgRaised    color.Color // main pane, cards (old BgPanel call sites move here)
	BgHighlight color.Color // chips, badges, keycaps
	BgOverlay   color.Color // dialog scrim/shadow
	Subtle      color.Color
	Green       color.Color
	Amber       color.Color
	Red         color.Color
	Info        color.Color
	OnAccent    color.Color

	// Back-compat aliases kept for existing call sites.
	Indigo color.Color // == Secondary
	Pink   color.Color // == Keyword
	Cyan   color.Color // == Accent
)

Colors (reassigned by Apply).

View Source
var (
	Title    lipgloss.Style
	Heading  lipgloss.Style
	Subtitle lipgloss.Style
	Key      lipgloss.Style
	Value    lipgloss.Style
	Faint    lipgloss.Style
	Bold     lipgloss.Style
	Success  lipgloss.Style
	Failure  lipgloss.Style
	Warn     lipgloss.Style

	AllowedBadge lipgloss.Style
	DeniedBadge  lipgloss.Style
	TableHeader  lipgloss.Style
	Panel        lipgloss.Style
	ActivePanel  lipgloss.Style
)

Styles (reassigned by Apply).

View Source
var Active = theme.Default()

Active is the currently applied theme.

Functions

func Allowed

func Allowed(ok bool) string

Allowed returns a styled ALLOWED/DENIED badge for a boolean outcome.

func Apply

func Apply(t theme.Theme)

Apply rebuilds every color and style from the given theme.

func Blend

func Blend(a, b color.Color, k float64) color.Color

Blend returns the color k of the way (in Lab space) from a to b. k=0 is a, k=1 is b. Falls back to a when either color can't be converted, or under the mono theme (no color blending).

func Bullet

func Bullet() string

Bullet returns a primary-colored bullet prefix.

func Chip

func Chip(text string, fg, bg color.Color) string

Chip renders a small filled label: bold fg on bg with 1-col padding.

func Dot

func Dot(state DotState) string

Dot returns a colored ● for the given state.

func FieldHighlight

func FieldHighlight() color.Color

FieldHighlight is the background that marks the focused form field's row: the base surface lifted toward the primary accent so the active field reads as "here" without falling back on a neutral gray.

func Gradient

func Gradient(s string) string

Gradient renders s with a per-rune color blend between the active theme's GradStartHex and GradEndHex (Lab space). Under the mono theme it returns the text unstyled; when the theme defines no gradient it falls back to a solid bold Primary.

func GradientBlock

func GradientBlock(s string) string

GradientBlock applies the brand gradient diagonally across multi-line block art (e.g. a wordmark): color advances with column + row so it flows from the top-left start color to the bottom-right end color. Mono/no-gradient themes fall back to solid bold Primary.

func GradientBlockPhase

func GradientBlockPhase(s string, phase float64) string

GradientBlockPhase renders block art like GradientBlock with the ramp position shifted by a drift phase. Phase 0 is byte-identical to GradientBlock. Mono/no-gradient themes fall back identically.

func GradientPill

func GradientPill(text string) string

GradientPill renders text on a per-rune brand-gradient background with OnAccent foreground — the active-nav treatment. Mono themes fall back to a plain Primary chip.

func GradientPillPhase

func GradientPillPhase(text string, phase float64) string

GradientPillPhase is GradientPill with a drift phase; phase 0 matches GradientPill exactly.

func Keycap

func Keycap(k string) string

Keycap renders a dim key hint pill (e.g. "q", "↵") on the raised surface.

func SanitizeTerminal

func SanitizeTerminal(s string) string

SanitizeTerminal removes escape sequences and control characters from untrusted text before it is styled for an interactive terminal.

func SectionHeader

func SectionHeader(title string, width int) string

SectionHeader renders a crush-style section header: a mid-tone bold title followed by a faint hairline rule filling the remaining width. This is the flat UI's structural primitive — panels are delimited by headers and whitespace, not borders.

func SectionHeaderFocused

func SectionHeaderFocused(title string, width int) string

SectionHeaderFocused renders the header with both the title and rule in the Primary accent, marking the main panel as the focused region.

func SectionHeaderTinted

func SectionHeaderTinted(title string, width int, tint color.Color) string

SectionHeaderTinted is SectionHeader with an explicit rule color, used for the one-frame verdict flash on the query Result header.

func SetTheme

func SetTheme(name string) bool

SetTheme applies a theme by name; returns false if unknown.

Types

type DotState

type DotState int

DotState selects the color of a status dot.

const (
	DotOnline  DotState = iota // mint
	DotBusy                    // amber
	DotError                   // coral
	DotOffline                 // faint
)

Jump to

Keyboard shortcuts

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