ui

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package ui defines the Mardi Gras design system: color palette, role and state colors, lipgloss styles, unicode symbols, gradients, and sparkline renderers. It contains no business logic.

Index

Constants

View Source
const (
	FleurDeLis = "⚜"

	// Status indicators
	SymRolling = "●"
	SymLinedUp = "♪"
	SymStalled = "⊘"
	SymPassed  = "✓"

	// Bead string
	BeadRound   = "●"
	BeadDiamond = "◆"
	BeadDash    = "─"

	// Navigation
	Cursor    = ">"
	Expanded  = "▼"
	Collapsed = "▶"

	// Dependencies
	DepArrow       = "→"
	DepTree        = "└─"
	SymMissing     = "!"
	SymResolved    = "✓" // alias of SymPassed
	SymNonBlocking = "·"
	SymNextArrow   = "next →"
	SymAgent       = "⚡"
	SymConvoy      = "◐"
	SymMail        = "✉"
	SymSling       = "➤"
	SymChanged     = "◈"
	SymSelected    = "◉"
	SymUnselected  = "○"

	// Due dates
	SymOverdue  = "▲"
	SymDeferred = "⏸"
	SymDueDate  = "◷"

	// Rich dependency types
	SymRelated    = "↔"
	SymDuplicates = "⊜"
	SymSupersedes = "⇢"

	// Section borders (rounded)
	BoxTopLeft     = "╭"
	BoxTopRight    = "╮"
	BoxBottomLeft  = "╰"
	BoxBottomRight = "╯"
	BoxHorizontal  = "─"
	BoxVertical    = "│"

	// Separators
	DividerH = "━"
	DividerV = "│"
	CornerTL = "┯"
	CornerBL = "┷"

	// Gas Town panel
	SymIdle          = "○"
	SymWorking       = "●"
	SymBackoff       = "◌"
	SymStuck         = "⚠" // alias of SymWarning — agent requesting help
	SymSpawning      = "◐" // half-filled — session starting
	SymGate          = "◷" // alias of SymDueDate — waiting on gate
	SymPaused        = "⏸" // alias of SymDeferred — intentionally suspended
	SymFixNeeded     = "🔧" // review feedback — needs rework
	SymPropelled     = "⚡" // ACP propulsion — output suppressed
	SymProgress      = "█"
	SymProgressEmpty = "░"
	SymDog           = "🐕"
	SymTown          = "⛽"

	// Problems
	SymWarning = "⚠"
	SymDeadRig = "💀"
	SymZombie  = "☠"

	// Molecule steps
	SymStepDone    = "✓"
	SymStepActive  = "●"
	SymStepReady   = "○"
	SymStepBlocked = "⊘"
	SymStepSkipped = "─"
	SymTierLine    = "│"

	// DAG flow connectors
	SymDAGFlow   = "│"
	SymDAGBranch = "┌"
	SymDAGFork   = "├"
	SymDAGJoin   = "└"
	SymDAGArrow  = "↓"

	// Geometric indicators
	SymDiamond = "◆"
)

Unicode symbols for the Mardi Gras theme.

Variables

View Source
var (
	// GradientProgress: green → gold → red (for progress bars, budgets).
	GradientProgress = NewGradient(BrightGreen, BrightGold, lipgloss.Color("#E74C3C"))

	// GradientHeat: green → orange → red (for age/staleness).
	GradientHeat = NewGradient(BrightGreen, lipgloss.Color("#E67E22"), lipgloss.Color("#E74C3C"))

	// GradientPurpleGold: purple → gold (Mardi Gras themed, for selection proximity).
	GradientPurpleGold = NewGradient2(DimPurple, BrightGold)

	// GradientFade: bright → dim (for list item positional fading).
	GradientFade = NewGradient2(White, Dim)
)

Pre-built gradients for common use cases.

View Source
var (
	// Header
	HeaderStyle = lipgloss.NewStyle().
				Bold(true).
				Background(DimPurple).
				Padding(0, 1)

	HeaderCounts = lipgloss.NewStyle().
					Foreground(Light)

	// Bead string decorations
	BeadStylePurple = lipgloss.NewStyle().Foreground(Purple)
	BeadStyleGold   = lipgloss.NewStyle().Foreground(Gold)
	BeadStyleGreen  = lipgloss.NewStyle().Foreground(Green)

	// Section headers in parade list (used for title text color within borders)
	SectionRolling = lipgloss.NewStyle().
					Bold(true).
					Foreground(StatusRolling)

	SectionLinedUp = lipgloss.NewStyle().
					Bold(true).
					Foreground(StatusLinedUp)

	SectionStalled = lipgloss.NewStyle().
					Bold(true).
					Foreground(StatusStalled)

	SectionPassed = lipgloss.NewStyle().
					Bold(true).
					Foreground(StatusPassed)

	// Issue items in the list
	ItemNormal = lipgloss.NewStyle().
				PaddingLeft(3)

	ItemSelected = lipgloss.NewStyle().
					PaddingLeft(1).
					Bold(true).
					Foreground(White)

	ItemCursor = lipgloss.NewStyle().
				Foreground(BrightGold).
				Bold(true)

	ItemSelectedBg = lipgloss.NewStyle().
					Background(DimPurple)

	// Detail panel (right side)
	DetailBorder = lipgloss.NewStyle().
					BorderLeft(true).
					BorderStyle(lipgloss.NormalBorder()).
					BorderForeground(DimPurple).
					PaddingLeft(1)

	DetailTitle = lipgloss.NewStyle().
				Bold(true).
				Foreground(White)

	DetailLabel = lipgloss.NewStyle().
				Foreground(Muted).
				Width(12)

	DetailValue = lipgloss.NewStyle().
				Foreground(Light)

	DetailSection = lipgloss.NewStyle().
					Bold(true).
					Foreground(BrightGold).
					MarginTop(1)

	// Priority badge
	BadgePriority = lipgloss.NewStyle().
					Bold(true)

	// Type badge
	BadgeType = lipgloss.NewStyle().
				Italic(true)

	// Footer
	FooterStyle = lipgloss.NewStyle().
				Foreground(Light).
				Background(DimPurple).
				Padding(0, 1)

	FooterKey = lipgloss.NewStyle().
				Bold(true).
				Foreground(BrightGold)

	FooterDesc = lipgloss.NewStyle().
				Foreground(Light)

	// Dependency display
	DepBlocked = lipgloss.NewStyle().
				Foreground(StatusStalled)

	DepBlocks = lipgloss.NewStyle().
				Foreground(StatusLinedUp)

	DepMissing = lipgloss.NewStyle().
				Foreground(StatusStalled).
				Bold(true)

	DepResolved = lipgloss.NewStyle().
				Foreground(StatusPassed)

	DepNonBlocking = lipgloss.NewStyle().
					Foreground(Muted)

	// Due date badges
	OverdueBadge = lipgloss.NewStyle().
					Foreground(StatusStalled).
					Bold(true)

	DueSoonBadge = lipgloss.NewStyle().
					Foreground(PrioP1) // orange

	DeferredStyle = lipgloss.NewStyle().
					Foreground(Dim)

	// Rich dependency styles
	DepRelated = lipgloss.NewStyle().
				Foreground(BrightPurple)

	DepDuplicates = lipgloss.NewStyle().
					Foreground(Muted).
					Italic(true)

	DepSupersedes = lipgloss.NewStyle().
					Foreground(BrightGold)

	AgentBadge  = lipgloss.NewStyle().Foreground(StatusAgent).Bold(true)
	ConvoyBadge = lipgloss.NewStyle().Foreground(StatusConvoy).Bold(true)
	GasTownTag  = lipgloss.NewStyle().Foreground(BrightPurple).Italic(true)

	// Gas Town panel
	GasTownBorder = lipgloss.NewStyle().
					BorderLeft(true).
					BorderStyle(lipgloss.NormalBorder()).
					BorderForeground(BrightGold).
					PaddingLeft(1)

	GasTownTitle = lipgloss.NewStyle().
					Bold(true).
					Foreground(BrightGold).
					MarginTop(1)

	GasTownLabel = lipgloss.NewStyle().
					Foreground(Muted)

	GasTownValue = lipgloss.NewStyle().
					Foreground(Light)

	GasTownAgentSelected = lipgloss.NewStyle().
							Background(DimPurple)

	GasTownHint = lipgloss.NewStyle().
				Foreground(Dim).
				MarginTop(1)

	FooterSource = lipgloss.NewStyle().
					Foreground(Muted)

	// Molecule step styles
	MolStepDone = lipgloss.NewStyle().
				Foreground(BrightGreen)

	MolStepActive = lipgloss.NewStyle().
					Foreground(BrightGold).
					Bold(true)

	MolStepReady = lipgloss.NewStyle().
					Foreground(Light)

	MolStepBlocked = lipgloss.NewStyle().
					Foreground(StatusStalled)

	MolTierLabel = lipgloss.NewStyle().
					Foreground(Dim).
					Italic(true)

	MolDAGFlow = lipgloss.NewStyle().
				Foreground(Dim)

	MolCritical = lipgloss.NewStyle().
				Foreground(BrightGold).
				Bold(true)

	// Metadata fields
	MetaFieldName = lipgloss.NewStyle().
					Foreground(Light)

	MetaFieldNameDim = lipgloss.NewStyle().
						Foreground(Muted)

	MetaFieldType = lipgloss.NewStyle().
					Foreground(Muted)

	MetaFieldValue = lipgloss.NewStyle().
					Foreground(BrightGreen)

	MetaRequired = lipgloss.NewStyle().
					Foreground(StatusStalled)

	// Filter Input
	InputPrompt = lipgloss.NewStyle().
				Foreground(BrightGold).
				Bold(true).
				PaddingLeft(1)

	InputText = lipgloss.NewStyle().
				Foreground(White)

	InputCursor = lipgloss.NewStyle().
				Foreground(Purple)

	// Help Overlay
	HelpOverlayBg = lipgloss.NewStyle().
					Border(lipgloss.RoundedBorder()).
					BorderForeground(BrightPurple).
					Background(lipgloss.Color("#121521")).
					Padding(1, 2)

	HelpTitle = lipgloss.NewStyle().
				Bold(true).
				Foreground(BrightGold).
				Align(lipgloss.Center)

	HelpSubtitle = lipgloss.NewStyle().
					Foreground(lipgloss.Color("#A9AFBF")).
					Align(lipgloss.Center)

	HelpSection = lipgloss.NewStyle().
				Bold(true).
				Foreground(BrightGreen).
				Underline(true)

	HelpKey = lipgloss.NewStyle().
			Bold(true).
			Foreground(Gold)

	HelpDesc = lipgloss.NewStyle().
				Foreground(lipgloss.Color("#D6D8DF"))

	HelpHint = lipgloss.NewStyle().
				Foreground(lipgloss.Color("#8E94A6")).
				Align(lipgloss.Center)

	// Toast notifications
	ToastInfo = lipgloss.NewStyle().
				Foreground(Light).
				Background(DimPurple).
				Padding(0, 1)

	ToastSuccess = lipgloss.NewStyle().
					Foreground(lipgloss.Color("#1A1A1A")).
					Background(BrightGreen).
					Bold(true).
					Padding(0, 1)

	ToastWarn = lipgloss.NewStyle().
				Foreground(lipgloss.Color("#1A1A1A")).
				Background(BrightGold).
				Bold(true).
				Padding(0, 1)

	ToastError = lipgloss.NewStyle().
				Foreground(White).
				Background(lipgloss.Color("#E74C3C")).
				Bold(true).
				Padding(0, 1)
)

Pre-built styles for the Mardi Gras theme.

View Source
var (
	// Core parade colors
	Purple = lipgloss.Color("#7B2D8E")
	Gold   = lipgloss.Color("#F5C518")
	Green  = lipgloss.Color("#1D8348")

	// Brighter variants for emphasis
	BrightPurple = lipgloss.Color("#9B59B6")
	BrightGold   = lipgloss.Color("#FFD700")
	BrightGreen  = lipgloss.Color("#2ECC71")

	// Dimmed variants for backgrounds/borders
	DimPurple = lipgloss.Color("#4A1259")
	DimGold   = lipgloss.Color("#8B7D00")
	DimGreen  = lipgloss.Color("#145A32")

	// Neutrals
	White   = lipgloss.Color("#FAFAFA")
	Light   = lipgloss.Color("#CCCCCC")
	Muted   = lipgloss.Color("#888888")
	Dim     = lipgloss.Color("#555555")
	Dark    = lipgloss.Color("#333333")
	Darkest = lipgloss.Color("#1A1A1A")

	// Semantic: parade status
	StatusRolling = BrightGreen
	StatusLinedUp = BrightGold
	StatusStalled = lipgloss.Color("#E74C3C")
	StatusPassed  = Muted
	StatusAgent   = BrightPurple
	StatusConvoy  = BrightGold
	StatusMail    = BrightGreen

	// Priority colors (P0=critical red → P4=backlog gray)
	PrioP0 = lipgloss.Color("#FF3333")
	PrioP1 = lipgloss.Color("#FF8C00")
	PrioP2 = BrightGold
	PrioP3 = BrightGreen
	PrioP4 = Muted

	// Issue type colors
	ColorBug     = lipgloss.Color("#E74C3C")
	ColorFeature = BrightPurple
	ColorTask    = BrightGold
	ColorChore   = Muted
	ColorEpic    = lipgloss.Color("#3498DB")

	// Neutrals (extra)
	Silver = lipgloss.Color("#AAAAAA")

	// Gas Town role colors
	RoleMayor    = BrightGold
	RoleDeacon   = lipgloss.Color("#3498DB") // Blue — town health monitor
	RolePolecat  = BrightGreen
	RoleCrew     = BrightPurple
	RoleWitness  = lipgloss.Color("#E67E22") // Orange — rig reviewer
	RoleRefinery = lipgloss.Color("#1ABC9C") // Teal — merge processor
	RoleDog      = lipgloss.Color("#8E44AD") // Deep purple — infrastructure worker
	RoleDefault  = Silver

	// Gas Town agent state colors
	StateWorking   = BrightGreen
	StateIdle      = Silver
	StateBackoff   = lipgloss.Color("#E74C3C")
	StateStuck     = lipgloss.Color("#FF8C00") // Amber — agent requesting help
	StateSpawn     = lipgloss.Color("#3498DB") // Cyan — session starting
	StateGate      = BrightGold                // Waiting on external trigger
	StateFixNeeded = lipgloss.Color("#E056A0") // Pink — review feedback, needs rework
	StatePropelled = lipgloss.Color("#00CED1") // Dark turquoise — ACP propulsion, output suppressed
)

Mardi Gras palette.

Functions

func AgentStateColor added in v0.2.0

func AgentStateColor(state string) color.Color

AgentStateColor returns the theme color for a Gas Town agent state.

func ApplyMardiGrasGradient

func ApplyMardiGrasGradient(text string) string

ApplyMardiGrasGradient applies a smooth Purple -> Gold -> Green gradient to the text.

func ApplyPartialMardiGrasGradient

func ApplyPartialMardiGrasGradient(text string, totalLength int) string

ApplyPartialMardiGrasGradient applies the gradient as if the text was `totalLength` characters long, ensuring a partial progress bar maps to the correct segment of the full color spectrum.

func ApplyShimmerGradient added in v0.2.0

func ApplyShimmerGradient(text string, offset float64) string

ApplyShimmerGradient applies the Mardi Gras gradient with a phase offset that shifts over time. The offset (0.0-1.0) rotates the gradient start point, creating a wave effect. A sine-based brightness modulation adds sparkle to individual characters.

func BrailleSparkline added in v0.9.0

func BrailleSparkline(data []float64, width int, style lipgloss.Style) string

BrailleSparkline renders a compact sparkline using braille characters. Each character cell encodes two data points for double horizontal resolution. The style is applied uniformly; use a gradient externally for colored sparklines.

func ConvoyPipeline added in v0.2.0

func ConvoyPipeline(statuses []string, maxWidth int) string

ConvoyPipeline renders a compact convoy progress pipeline: ●─●─◐─○─○ Each position represents a tracked issue: ● closed, ◐ in_progress, ○ open.

func DualSparkline added in v0.9.0

func DualSparkline(top, bottom []float64, width int, topStyle, bottomStyle lipgloss.Style) string

DualSparkline renders two datasets stacked vertically in the same row. Top data uses upper blocks (▀), bottom uses lower blocks (▄), overlap uses (█). This doubles the information density — e.g. cost rate above, velocity below.

func GradientBar added in v0.9.0

func GradientBar(pct float64, width int, g Gradient) string

GradientBar renders a progress bar where each filled block is colored by its position along the gradient. Unfilled portion uses dim blocks.

func HeatChar added in v0.2.0

func HeatChar(eventCount, maxCount int) string

HeatChar returns a single character with color indicating activity level. 0 events = dim dot, low = green, medium = gold, high = red.

func HighlightMatches added in v0.2.0

func HighlightMatches(text string, indices []int, maxLen int) string

HighlightMatches renders a string with matched character positions highlighted. Matched characters are rendered in bright gold bold; others use default style.

func IssueTypeColor

func IssueTypeColor(t string) color.Color

func MiniSparkline added in v0.9.0

func MiniSparkline(values [3]int) string

MiniSparkline renders a compact 3-character activity indicator using block elements. Values should be recent activity counts (e.g. last 3 time periods). Returns empty string if all values are zero.

func PriorityColor

func PriorityColor(p int) color.Color

PriorityColor returns the theme color for a priority level.

func RenderSparkline added in v0.2.0

func RenderSparkline(values []int, width int) string

RenderSparkline renders a compact sparkline from integer values. Each value maps to one block character (8 height levels). Colors follow a green→gold→red gradient based on value intensity.

func RoleBadge added in v0.2.0

func RoleBadge(role string) string

RoleBadge returns a styled badge for a Gas Town role.

func RoleColor added in v0.2.0

func RoleColor(role string) color.Color

IssueTypeColor returns the theme color for an issue type. RoleColor returns the theme color for a Gas Town agent role.

func SectionDivider added in v0.2.0

func SectionDivider(title string, width int, focused bool) string

SectionDivider renders a btop-style section divider: ── ⚜ TITLE ────────── When focused, the fleur-de-lis and cursor glow bright gold.

func StateBadge added in v0.2.0

func StateBadge(state string) string

StateBadge returns a styled badge for an agent state.

func Superscript added in v0.9.0

func Superscript(n int) string

Superscript converts a non-negative integer to superscript Unicode digits.

Types

type Gradient added in v0.9.0

type Gradient [101]lipgloss.Style

Gradient is a pre-computed array of 101 styles (0-100%) for smooth color transitions.

func NewGradient added in v0.9.0

func NewGradient(start, mid, end color.Color) Gradient

NewGradient creates a 3-point gradient: start (0%) → mid (50%) → end (100%). Uses Luv color space blending for perceptually uniform transitions.

func NewGradient2 added in v0.9.0

func NewGradient2(start, end color.Color) Gradient

NewGradient2 creates a 2-point gradient: start (0%) → end (100%).

func (Gradient) At added in v0.9.0

func (g Gradient) At(pct int) lipgloss.Style

At returns the style at the given percentage (clamped to 0-100).

Jump to

Keyboard shortcuts

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