ui

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package ui is the shared TUI theme for AgentBBS: one palette and a small set of structural widgets (cards, menu rows, status badges, key bars) so every screen — the hub and each plugin — looks like part of the same product.

Screens keep their own accent color for identity (the hub is green, the arcade amber, the newsreader purple) by constructing a Theme with that accent; the layout primitives are shared.

Index

Constants

View Source
const (
	Green  = lipgloss.Color("#4ade80")
	Cyan   = lipgloss.Color("#38bdf8")
	Blue   = lipgloss.Color("#60a5fa")
	Gold   = lipgloss.Color("#fbbf24")
	Purple = lipgloss.Color("#c084fc")
	Red    = lipgloss.Color("#f87171")
)

Palette — the only colors any screen should reach for.

View Source
const (
	BadgeOK    = "ok"
	BadgeInfo  = "info"
	BadgeGold  = "gold"
	BadgeWarn  = "warn"
	BadgeMuted = "muted"
)

Badge variants.

Variables

View Source
var (
	// Frame is the outer padding every top-level View should wrap itself in.
	Frame = lipgloss.NewStyle().Padding(1, 2)
	// Dim is for secondary text (descriptions, metadata).
	Dim = lipgloss.NewStyle().Foreground(muted)
	// Body is primary readable text.
	Body = lipgloss.NewStyle().Foreground(text)
	// Danger is for errors and warnings.
	Danger = lipgloss.NewStyle().Foreground(Red)
)

Structural styles shared by every screen.

Functions

func Badge

func Badge(variant, label string) string

Badge renders a small filled status tag, e.g. Badge(BadgeOK, "guests welcome").

func KeyBar

func KeyBar(s string) string

KeyBar renders a footer hint, emphasizing the key token of each segment. It accepts the conventional " · "-separated form ("↑/↓ move · enter select · q quit") so call sites read naturally; the first word of each segment is brightened as the key.

Types

type Theme

type Theme struct{ Accent lipgloss.Color }

Theme carries one screen's accent color and renders the shared widgets in it.

func New

func New(accent lipgloss.Color) Theme

New returns a theme that tints titles, sections, card borders, cursors, and selected rows with accent (use a palette color).

func (Theme) Card

func (t Theme) Card(title, body string) string

Card frames body in a rounded border tinted with the accent. A non-empty title is rendered as a section header at the top of the card.

func (Theme) MenuItem

func (t Theme) MenuItem(selected bool, label, badge, desc string) string

MenuItem renders one polished menu line shared by the hub and the plugin menus (PRD §4.1): an accent cursor and bold label when selected, an optional status badge after the label, and — to keep long menus uncluttered — the description shown only for the focused row. The result ends in a newline.

func (Theme) Row

func (t Theme) Row(selected bool, label, desc string) string

Row renders one selectable menu line: an accent cursor and bold label when selected, with a dimmed description on the next line. An empty desc yields a single-line row. The returned string ends in a newline.

func (Theme) Section

func (t Theme) Section(s string) string

Section renders an upper-cased sub-heading inside a screen.

func (Theme) Title

func (t Theme) Title(s string) string

Title renders the screen's main heading.

Jump to

Keyboard shortcuts

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