Documentation
¶
Overview ¶
Package theme provides the palette, base lipgloss styles, and shared layout primitives used across yedit-built TUIs.
Index ¶
- Variables
- func CenterBox(box string, term Size) string
- func RenderHeader(title, subtitle, right string, width int) string
- func RenderTitledPanel(title string, size Size, active bool, content string) string
- func RenderTwoColumnView(layout TwoColumnLayout) string
- func TwoColumnWidths(totalWidth int) (listW, rightW int)
- type Size
- type TwoColumnLayout
Constants ¶
This section is empty.
Variables ¶
var ( Accent = colorVal("63") // blue — active borders, primary highlight AccentBright = colorVal("212") // pink — titles, selection Muted = colorVal("240") // grey — inactive borders, status hints Dim = colorVal("245") // light grey — secondary text Success = colorVal("82") // green — existing/added items, success alerts Danger = colorVal("196") // red — error alerts )
Palette — narrow on purpose. Clients can extend it with their own colours; add to this list only when at least two yedit components need it.
var ( SelectedItem = lipgloss.NewStyle().Bold(true).Foreground(AccentBright) ExistingItem = lipgloss.NewStyle().Foreground(Success) AvailableItem = lipgloss.NewStyle().Foreground(Dim) StatusBar = lipgloss.NewStyle().Foreground(Muted).PaddingLeft(1) )
Common item styles. Each TUI is free to compose its own variants on top.
Functions ¶
func CenterBox ¶
CenterBox positions box at the centre of the given terminal Size by adding padding. Used by floating overlay/alert/picker views.
func RenderHeader ¶
RenderHeader returns a single-line header. title is rendered bold on the left, subtitle (if non-empty) follows after a separator, right (if non-empty) is right-aligned for context such as filenames.
func RenderTitledPanel ¶
RenderTitledPanel renders a rounded-border panel with the title embedded in the top edge: ╭─ Title ──────╮. size holds the OUTER dimensions (including the border rows/cols).
func RenderTwoColumnView ¶
func RenderTwoColumnView(layout TwoColumnLayout) string
RenderTwoColumnView assembles the standard two-panel screen: header, panels side by side, a feedback line, and a hint line.
func TwoColumnWidths ¶
TwoColumnWidths computes left and right column widths for the standard two-panel layout: left is totalWidth/3, clamped to [30, 60]; right gets the remainder minus 4 chars for the two border pairs.