ui

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package ui provides shared UI styling and components for the TUI application.

Index

Constants

View Source
const (
	ColKeyName     = "name"
	ColKeyWorkflow = "workflow"
	ColTitleName   = "Name"
)

Column keys and titles shared by more than one table.

View Source
const (
	ColWidthReq = 3
	ColMinFlag  = 1
	ColMinCount = 4
	ColMinShort = 6
	ColMinLabel = 8
	ColMinName  = 10

	ColMaxFlag   = 1
	ColMaxCount  = 4
	ColMaxSteps  = 5
	ColMaxTime   = 12
	ColMaxStatus = 14
	ColMaxValue  = 24
	ColMaxBranch = 28
	ColMaxName   = 36

	WeightLow  = 1
	WeightMid  = 2
	WeightHigh = 3

	PrioFirstToGo  = 1
	PrioSecondToGo = 2
	PrioThirdToGo  = 3
)

Column sizing vocabulary shared by every table, in display cells. Naming the floors keeps a table readable as a set of tradeoffs rather than a wall of digits. Every column holding a short value is capped, because surplus width spread across them pushes a row's cells so far apart that the eye has to travel between them on a wide terminal.

View Source
const PaneBorderSize = 2

PaneBorderSize is the space a pane's border occupies on each axis, which is what separates the width a pane is given from the width its content gets.

View Source
const RowGutterWidth = 2

RowGutterWidth is the "> " selection gutter and any status glyph that sit left of the first column, which the table itself never sees.

Variables

View Source
var (
	PrimaryColor   color.Color
	SecondaryColor color.Color
	AccentColor    color.Color
	MutedColor     color.Color
	SoftMutedColor color.Color
	TextColor      color.Color
	ModalBgColor   color.Color
	ErrorColor     color.Color
	LinkColor      color.Color
)

Colors used throughout the UI.

View Source
var (
	BorderStyle        lipgloss.Style
	CLIPreviewStyle    lipgloss.Style
	ErrorStyle         lipgloss.Style
	ErrorTitleStyle    lipgloss.Style
	FocusedBorderStyle lipgloss.Style
	HelpStyle          lipgloss.Style
	LinkStyle          lipgloss.Style
	NormalStyle        lipgloss.Style
	SelectedStyle      lipgloss.Style
	SubtitleStyle      lipgloss.Style
	TableDefaultStyle  lipgloss.Style
	TableDimmedStyle   lipgloss.Style
	TableHeaderStyle   lipgloss.Style
	TableItalicStyle   lipgloss.Style
	TableRowStyle      lipgloss.Style
	TableSelectedStyle lipgloss.Style
	TitleStyle         lipgloss.Style
)

Styles for the application (initialized in ApplyTheme).

Functions

func ApplyFuzzyFilter

func ApplyFuzzyFilter(query string, items []string) []string

ApplyFuzzyFilter returns items filtered by query using fuzzy matching. Returns original items if query is empty.

func ApplyTheme

func ApplyTheme()

ApplyTheme updates all colors and styles from the current palette. The three roles beyond theme.Semantic are named here because only this application needs them: a softer muted for defaults, a modal ground, and a link color.

func ConfigColumns added in v1.2.0

func ConfigColumns() []table.Column

ConfigColumns describes the workflow-input table. Name is the column a reader scans, so it keeps the most weight and is the last to give ground.

func FitColumns added in v1.2.0

func FitColumns(cols []table.Column, width, gutter int) table.Layout

FitColumns resolves cols against the room a pane leaves for its rows, past the gutter its selection indicator and status glyphs occupy.

func FormatEmptyValue

func FormatEmptyValue(val string) string

FormatEmptyValue returns the display string for a value, showing ("") for empty strings.

func InitTheme

func InitTheme(p theme.Palette)

InitTheme sets the palette and applies colors.

func PaneStyle

func PaneStyle(width, height int, focused bool) lipgloss.Style

PaneStyle returns a style for a pane with optional focus. Lipgloss counts the border inside Width and Height, so the pane occupies exactly the width and height it is given and its content gets PaneBorderSize less.

func RemoveListBackgrounds

func RemoveListBackgrounds(l list.Model) list.Model

RemoveListBackgrounds removes all backgrounds from a list.Model for modal overlay.

func RenderEmptyValue

func RenderEmptyValue(val string) string

RenderEmptyValue returns a styled string for a value, using italic style for empty strings.

func RenderScrollIndicator

func RenderScrollIndicator(hasMore, hasLess bool) string

RenderScrollIndicator renders scroll arrows (^ and v) for lists.

func TableHeader added in v1.2.0

func TableHeader(layout table.Layout, gutter int) string

TableHeader renders a column header indented past the row gutter.

func TableRow added in v1.2.0

func TableRow(layout table.Layout, values map[string]string) string

TableRow pads each value to its resolved column width, skipping the columns collapse hid.

Types

This section is empty.

Directories

Path Synopsis
Package modal provides modal dialogs for user interactions in the TUI application.
Package modal provides modal dialogs for user interactions in the TUI application.
Package panes provides the main UI panes for workflow, history, and configuration views.
Package panes provides the main UI panes for workflow, history, and configuration views.

Jump to

Keyboard shortcuts

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