tui

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package tui provides shared TUI components for Lango CLI commands.

Index

Constants

View Source
const (
	CheckPass = "✓"
	CheckWarn = "⚠"
	CheckFail = "✗"
	Spinner   = "◌"
)

Check result indicators

Variables

View Source
var (
	Primary    = lipgloss.Color("#7C3AED") // Purple
	Success    = lipgloss.Color("#10B981") // Green
	Warning    = lipgloss.Color("#F59E0B") // Amber
	Error      = lipgloss.Color("#EF4444") // Red
	Muted      = lipgloss.Color("#6B7280") // Gray
	Foreground = lipgloss.Color("#F9FAFB") // White
	Background = lipgloss.Color("#1F2937") // Dark gray
	Highlight  = lipgloss.Color("#3B82F6") // Blue
	Accent     = lipgloss.Color("#04B575") // Green (selection/focus)
	Dim        = lipgloss.Color("#626262") // Dim gray (descriptions)
	Separator  = lipgloss.Color("#374151") // Dark gray (dividers)
)

Color palette for consistent theming

View Source
var (
	// TitleStyle for main headers
	TitleStyle = lipgloss.NewStyle().
				Bold(true).
				Foreground(Primary).
				MarginBottom(1)

	// SubtitleStyle for secondary headers
	SubtitleStyle = lipgloss.NewStyle().
					Foreground(Muted).
					MarginBottom(1)

	// SuccessStyle for success messages
	SuccessStyle = lipgloss.NewStyle().
					Foreground(Success)

	// WarningStyle for warning messages
	WarningStyle = lipgloss.NewStyle().
					Foreground(Warning)

	// ErrorStyle for error messages
	ErrorStyle = lipgloss.NewStyle().
				Foreground(Error)

	// MutedStyle for less important text
	MutedStyle = lipgloss.NewStyle().
				Foreground(Muted)

	// HighlightStyle for emphasized text
	HighlightStyle = lipgloss.NewStyle().
					Foreground(Highlight).
					Bold(true)

	// BoxStyle for bordered containers
	BoxStyle = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(Muted).
				Padding(1, 2)

	// ListItemStyle for list items
	ListItemStyle = lipgloss.NewStyle().
					PaddingLeft(2)

	// SelectedItemStyle for selected list items
	SelectedItemStyle = lipgloss.NewStyle().
						PaddingLeft(2).
						Foreground(Primary).
						Bold(true)

	// SectionHeaderStyle for menu section titles
	SectionHeaderStyle = lipgloss.NewStyle().
						Foreground(Highlight).
						Bold(true).
						PaddingLeft(2)

	// SeparatorLineStyle for section dividers
	SeparatorLineStyle = lipgloss.NewStyle().
						Foreground(Separator)

	// CursorStyle for the selection arrow
	CursorStyle = lipgloss.NewStyle().
				Foreground(Accent)

	// ActiveItemStyle for highlighted/selected items
	ActiveItemStyle = lipgloss.NewStyle().
					Foreground(Accent).
					Bold(true)

	// SearchBarStyle for the search input container
	SearchBarStyle = lipgloss.NewStyle().
					Border(lipgloss.RoundedBorder()).
					BorderForeground(Primary).
					Padding(0, 1)

	// FormTitleBarStyle for form titles
	FormTitleBarStyle = lipgloss.NewStyle().
						Bold(true).
						Foreground(Primary).
						Border(lipgloss.NormalBorder(), false, false, true, false).
						BorderForeground(Primary).
						MarginBottom(1)

	// FieldDescStyle for field description/help text
	FieldDescStyle = lipgloss.NewStyle().
					Foreground(Dim).
					Italic(true).
					PaddingLeft(2)

	// BadgeAdvancedStyle for the ADV badge on advanced categories
	BadgeAdvancedStyle = lipgloss.NewStyle().
						Foreground(Foreground).
						Background(Muted).
						Bold(true).
						Padding(0, 1)

	// BadgeDependencyStyle for the dependency warning badge on categories
	BadgeDependencyStyle = lipgloss.NewStyle().
							Foreground(Foreground).
							Background(Warning).
							Bold(true).
							Padding(0, 1)
)

Base styles for TUI components

Functions

func Banner() string

Banner returns the squirrel mascot with brand info side-by-side.

func BannerBox

func BannerBox() string

BannerBox wraps the Banner in a rounded border box (for settings welcome).

func Breadcrumb(segments ...string) string

Breadcrumb renders a navigation path like "Settings > Agent Configuration".

func FormatFail

func FormatFail(msg string) string

FormatFail formats a failing check message

func FormatMuted

func FormatMuted(msg string) string

FormatMuted formats muted/hint text

func FormatPass

func FormatPass(msg string) string

FormatPass formats a passing check message

func FormatWarn

func FormatWarn(msg string) string

FormatWarn formats a warning message

func GetVersion added in v0.6.0

func GetVersion() string

GetVersion returns the current version string.

func HelpBar

func HelpBar(entries ...string) string

HelpBar renders a full help footer from HelpEntry results.

func HelpEntry

func HelpEntry(key, label string) string

HelpEntry renders a single help entry: key badge + label.

func KeyBadge

func KeyBadge(key string) string

KeyBadge renders a keyboard shortcut as a styled badge.

func ServeBanner

func ServeBanner() string

ServeBanner returns a banner for the serve command with a separator line.

func SetProfile

func SetProfile(name string)

SetProfile injects the active profile name.

func SetVersionInfo

func SetVersionInfo(version, buildTime string)

SetVersionInfo injects version and build time from main.go.

func StartupSummary added in v0.6.0

func StartupSummary(features []FeatureLine) string

StartupSummary renders activated features based on config flags. Each entry is a key string mapped to an enabled bool and optional detail.

Types

type FeatureLine added in v0.6.0

type FeatureLine struct {
	Name    string
	Enabled bool
	Detail  string
}

FeatureLine describes a single feature for startup summary.

Jump to

Keyboard shortcuts

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