ui

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Color palette using terminal colors for consistency
	ColorSuccess = lipgloss.AdaptiveColor{Light: "2", Dark: "2"} // Green
	ColorError   = lipgloss.AdaptiveColor{Light: "1", Dark: "1"} // Red
	ColorPrimary = lipgloss.AdaptiveColor{Light: "5", Dark: "5"} // Magenta/Purple
	ColorInfo    = lipgloss.AdaptiveColor{Light: "6", Dark: "6"} // Cyan
	ColorMuted   = lipgloss.AdaptiveColor{Light: "8", Dark: "8"} // Gray
	ColorWarning = lipgloss.AdaptiveColor{Light: "3", Dark: "3"} // Yellow
	ColorAccent  = lipgloss.AdaptiveColor{Light: "4", Dark: "4"} // Blue
	ColorDefault = lipgloss.AdaptiveColor{Light: "7", Dark: "7"} // White

	// Base styles
	StyleSuccess = lipgloss.NewStyle().
					Foreground(ColorSuccess).
					Bold(true)

	StyleError = lipgloss.NewStyle().
				Foreground(ColorError).
				Bold(true)

	StylePrimary = lipgloss.NewStyle().
					Foreground(ColorPrimary).
					Bold(true)

	StyleInfo = lipgloss.NewStyle().
				Foreground(ColorInfo)

	StyleMuted = lipgloss.NewStyle().
				Foreground(ColorMuted)

	StyleWarning = lipgloss.NewStyle().
					Foreground(ColorWarning).
					Bold(true)

	StyleAccent = lipgloss.NewStyle().
				Foreground(ColorAccent)

	// Component styles
	StyleTitle = lipgloss.NewStyle().
				Foreground(ColorPrimary).
				Bold(true).
				Underline(true)

	StyleHeader = lipgloss.NewStyle().
				Foreground(ColorPrimary).
				Bold(true)

	StyleSubtle = lipgloss.NewStyle().
				Foreground(ColorMuted).
				Italic(true)

	StyleBold = lipgloss.NewStyle().
				Bold(true)

	// Table styles
	StyleTableHeader = lipgloss.NewStyle().
						Foreground(ColorPrimary).
						Bold(true).
						Align(lipgloss.Left)

	StyleTableRow = lipgloss.NewStyle().
					Foreground(ColorDefault)

	StyleTableRowAlt = lipgloss.NewStyle().
						Foreground(ColorDefault).
						Faint(true)

	StyleTableBorder = lipgloss.NewStyle().
						Foreground(ColorMuted)

	// Status icons
	IconSuccess = "✔"
	IconError   = "✘"
	IconRocket  = "🚀"
	IconInfo    = "ℹ"
	IconWarning = "⚠"
	IconNote    = "📝"
	IconBuild   = "🔨"
	IconTag     = "🏷"
)

Functions

func FormatBold

func FormatBold(text string) string

FormatBold returns bold text

func FormatError

func FormatError(msg string) string

FormatError returns an error message with icon

func FormatInfo

func FormatInfo(msg string) string

FormatInfo returns an info message with icon

func FormatMuted

func FormatMuted(text string) string

FormatMuted returns muted/subtle text

func FormatRocket

func FormatRocket(msg string) string

FormatRocket returns a rocket message (for exciting actions)

func FormatSuccess

func FormatSuccess(msg string) string

FormatSuccess returns a success message with icon

func FormatTitle

func FormatTitle(title string) string

FormatTitle returns a formatted title

func FormatWarning

func FormatWarning(msg string) string

FormatWarning returns a warning message with icon

func RenderKeyValue

func RenderKeyValue(key, value string) string

RenderKeyValue renders a key-value pair

func RenderSimpleList

func RenderSimpleList(items []string) string

RenderSimpleList renders a simple bulleted list

Types

type Table

type Table struct {
	Columns []TableColumn
	Rows    [][]string
}

Table represents a data table

func NewTable

func NewTable(columns []TableColumn) *Table

NewTable creates a new table with specified columns

func (*Table) AddRow

func (t *Table) AddRow(cells []string)

AddRow adds a row to the table

func (*Table) Render

func (t *Table) Render() string

Render renders the table as a string

type TableColumn

type TableColumn struct {
	Header string
	Width  int
	Align  string // "left", "right", "center"
}

TableColumn represents a column in the table

Jump to

Keyboard shortcuts

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