Documentation
¶
Overview ¶
Package ui provides styled CLI output components using lipgloss
Index ¶
- Variables
- func Bold(text string) string
- func Card(title string, content []string) string
- func CheckList(items []CheckItem) string
- func Dim(text string) string
- func DimStyle() lipgloss.Style
- func Divider() string
- func Error(msg string) string
- func Header(text string) string
- func Highlight(text string) string
- func Info(msg string) string
- func KeyValue(items [][2]string, keyWidth int) string
- func KeyValueCard(title string, pairs map[string]string) string
- func LabelValue(label, value string) string
- func List(items []string) string
- func PadCenter(s string, width int) string
- func PadLeft(s string, width int) string
- func PadRight(s string, width int) string
- func PriorityStyle(priority int) lipgloss.Style
- func ProgressBar(width int, progress int) string
- func ProviderCard(name, displayName, description, authType, status string, ...) string
- func QuadrantStyle(quadrant int) lipgloss.Style
- func Section(header string, content string) string
- func StatusBadge(status string) string
- func StatusBarStyle() lipgloss.Style
- func StringWidth(s string) int
- func Success(msg string) string
- func TaskCard(status string) lipgloss.Style
- func ThemeTitleStyle() lipgloss.Style
- func Warning(msg string) string
- type CheckItem
- type Column
- type SimpleTable
- type Table
Constants ¶
This section is empty.
Variables ¶
var ( // Primary colors PrimaryColor = lipgloss.Color("#7C3AED") // Purple SecondaryColor = lipgloss.Color("#3B82F6") // Blue // Status colors SuccessColor = lipgloss.Color("#10B981") // Green ErrorColor = lipgloss.Color("#EF4444") // Red WarningColor = lipgloss.Color("#F59E0B") // Yellow/Amber InfoColor = lipgloss.Color("#6B7280") // Gray // UI colors BorderColor = lipgloss.Color("#374151") // Dark gray HeaderBgColor = lipgloss.Color("#1F2937") // Darker gray AltRowColor = lipgloss.Color("#1A1A2E") // Alternate row background )
Color palette
var ( // TitleStyle for main titles TitleStyle = lipgloss.NewStyle(). Bold(true). Foreground(PrimaryColor). MarginBottom(1). Padding(0, 1) // HeaderStyle for table headers HeaderStyle = lipgloss.NewStyle(). Bold(true). Foreground(lipgloss.Color("#FFFFFF")). Background(HeaderBgColor). Padding(0, 1) // RowStyle for table rows RowStyle = lipgloss.NewStyle(). Padding(0, 1) // AltRowStyle for alternating table rows AltRowStyle = lipgloss.NewStyle(). Background(AltRowColor). Padding(0, 1) // SelectedStyle for selected items SelectedStyle = lipgloss.NewStyle(). Background(lipgloss.Color("#374151")). Foreground(lipgloss.Color("#FFFFFF")) // CardStyle for card-like containers CardStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(BorderColor). Padding(1, 2). Margin(1, 0) )
Base styles
var ( // SuccessStyle for success messages SuccessStyle = lipgloss.NewStyle(). Foreground(SuccessColor). Bold(true) // ErrorStyle for error messages ErrorStyle = lipgloss.NewStyle(). Foreground(ErrorColor). Bold(true) // WarningStyle for warning messages WarningStyle = lipgloss.NewStyle(). Foreground(WarningColor) // InfoStyle for informational messages InfoStyle = lipgloss.NewStyle(). Foreground(InfoColor) // EnabledStyle for enabled status EnabledStyle = SuccessStyle // DisabledStyle for disabled status DisabledStyle = lipgloss.NewStyle(). Foreground(InfoColor) )
Status styles
var ( // LabelStyle for field labels LabelStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#9CA3AF")). Bold(true) // ValueStyle for field values ValueStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#E5E7EB")) )
Label and value styles
var ( StatusEnabled = SuccessStyle.Render("✅ 已启用") StatusDisabled = DisabledStyle.Render("❌ 未启用") StatusConnected = SuccessStyle.Render("✅ 已连接") StatusNotConfigured = DisabledStyle.Render("❌ 未配置") StatusExpired = WarningStyle.Render("⚠️ 已过期") )
Status text helpers
var ( ThemePurple = lipgloss.Color("#7C3AED") ThemeGreen = lipgloss.Color("#22C55E") ThemeOrange = lipgloss.Color("#F59E0B") ThemeRed = lipgloss.Color("#EF4444") ThemeGray = lipgloss.Color("#94A3B8") ThemeBgDark = lipgloss.Color("#1E1E2E") ThemeBgCard = lipgloss.Color("#2D2D3F") ThemeText = lipgloss.Color("#E2E8F0") ThemeDimText = lipgloss.Color("#64748B") )
Theme colors (Claude Code inspired)
Functions ¶
func KeyValueCard ¶
KeyValueCard creates a card with key-value pairs
func PriorityStyle ¶ added in v1.0.4
PriorityStyle returns a bold style colored by priority level.
func ProgressBar ¶ added in v1.0.4
ProgressBar renders a gradient progress bar with the given width and progress (0-100).
func ProviderCard ¶
func ProviderCard(name, displayName, description, authType, status string, capabilities []CheckItem) string
ProviderCard creates a styled provider information card
func QuadrantStyle ¶ added in v1.0.4
QuadrantStyle returns a background-colored style for Eisenhower matrix quadrants.
func StatusBadge ¶
StatusBadge creates a colored status badge
func StatusBarStyle ¶ added in v1.0.4
StatusBarStyle returns a style for the TUI bottom status bar.
func StringWidth ¶
StringWidth calculates the display width of a string (supporting CJK characters)
func TaskCard ¶ added in v1.0.4
TaskCard returns a card style with a colored left border based on task status.
func ThemeTitleStyle ¶ added in v1.0.4
ThemeTitleStyle returns a style for TUI headers.
Types ¶
type SimpleTable ¶
type SimpleTable struct {
// contains filtered or unexported fields
}
SimpleTable creates a simple aligned table without borders
func NewSimpleTable ¶
func NewSimpleTable(columns ...Column) *SimpleTable
NewSimpleTable creates a simple table
func (*SimpleTable) AddRow ¶
func (t *SimpleTable) AddRow(cells ...string) *SimpleTable
AddRow adds a row to the simple table
func (*SimpleTable) HideHeader ¶
func (t *SimpleTable) HideHeader() *SimpleTable
HideHeader hides the table header