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
- Variables
- func Allowed(ok bool) string
- func Apply(t theme.Theme)
- func Blend(a, b color.Color, k float64) color.Color
- func Bullet() string
- func Chip(text string, fg, bg color.Color) string
- func Dot(state DotState) string
- func FieldHighlight() color.Color
- func Gradient(s string) string
- func GradientBlock(s string) string
- func GradientBlockPhase(s string, phase float64) string
- func GradientPill(text string) string
- func GradientPillPhase(text string, phase float64) string
- func Keycap(k string) string
- func PercentColor(pct float64) lipgloss.Style
- func SanitizeTerminal(s string) string
- func SectionHeader(title string, width int) string
- func SectionHeaderFocused(title string, width int) string
- func SectionHeaderTinted(title string, width int, tint color.Color) string
- func SetTheme(name string) bool
- type DotState
Constants ¶
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 ¶
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).
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).
var Active = theme.Default()
Active is the currently applied theme.
Functions ¶
func Blend ¶
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 FieldHighlight ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
GradientPillPhase is GradientPill with a drift phase; phase 0 matches GradientPill exactly.
func PercentColor ¶ added in v0.266.0
PercentColor picks the coverage-percentage style by threshold: full coverage reads success/green, zero reads failure/red, and any partial amount in between reads warn/amber (the closest existing primitive to a dedicated "attention" color).
func SanitizeTerminal ¶
SanitizeTerminal removes escape sequences and control characters from untrusted text before it is styled for an interactive terminal.
func SectionHeader ¶
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 ¶
SectionHeaderFocused renders the header with both the title and rule in the Primary accent, marking the main panel as the focused region.
func SectionHeaderTinted ¶
SectionHeaderTinted is SectionHeader with an explicit rule color, used for the one-frame verdict flash on the query Result header.