ui

package
v0.0.0-...-f9a37e3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MaxWidth = 90

Variables

View Source
var (
	ColorAccent = lipgloss.Color("#fab283") // warm peach/orange — primary accent
	ColorGreen  = lipgloss.Color("#7fd88f")
	ColorRed    = lipgloss.Color("#e06c75")
	ColorYellow = lipgloss.Color("#f5a742")
	ColorBlue   = lipgloss.Color("#56b6c2")
	ColorPurple = lipgloss.Color("#9d7cd8")
	ColorDim    = lipgloss.Color("#555555")
	ColorMuted  = lipgloss.Color("#808080")
	ColorWhite  = lipgloss.Color("#eeeeee")
	ColorBorder = lipgloss.Color("#2a2a2a")
	ColorPanel  = lipgloss.Color("#141414")
	ColorBg     = lipgloss.Color("#0a0a0a")
)
View Source
var (
	IconSuccess = lipgloss.NewStyle().Foreground(ColorGreen).Render("•")
	IconError   = lipgloss.NewStyle().Foreground(ColorRed).Render("•")
	IconWarn    = lipgloss.NewStyle().Foreground(ColorYellow).Render("△")
	IconPending = lipgloss.NewStyle().Foreground(ColorBlue).Render("○")
	IconArrow   = lipgloss.NewStyle().Foreground(ColorAccent).Render("→")
	IconDot     = lipgloss.NewStyle().Foreground(ColorDim).Render("·")
)
View Source
var (
	Bold      = lipgloss.NewStyle().Bold(true)
	Dim       = lipgloss.NewStyle().Foreground(ColorDim)
	Muted     = lipgloss.NewStyle().Foreground(ColorMuted)
	Subtle    = lipgloss.NewStyle().Foreground(ColorDim).Italic(true)
	Highlight = lipgloss.NewStyle().Foreground(ColorAccent).Bold(true)
	Success   = lipgloss.NewStyle().Foreground(ColorGreen)
	Error     = lipgloss.NewStyle().Foreground(ColorRed)
	Warn      = lipgloss.NewStyle().Foreground(ColorYellow)
	Info      = lipgloss.NewStyle().Foreground(ColorBlue)
	White     = lipgloss.NewStyle().Foreground(ColorWhite)
	Accent    = lipgloss.NewStyle().Foreground(ColorAccent)
)
View Source
var (
	SectionTitle = lipgloss.NewStyle().
					Foreground(ColorMuted).
					Bold(true).
					MarginTop(1)

	StepStyle = lipgloss.NewStyle().
				Foreground(ColorAccent).
				Bold(true)
)
View Source
var (
	Panel = lipgloss.NewStyle().
			Border(lipgloss.RoundedBorder()).
			BorderForeground(ColorBorder).
			Padding(1, 2)

	SuccessPanel = lipgloss.NewStyle().
					Border(lipgloss.RoundedBorder()).
					BorderForeground(ColorGreen).
					Padding(1, 2)

	ErrorPanel = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(ColorRed).
				Padding(1, 2)

	WarnPanel = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(ColorYellow).
				Padding(1, 2)

	InfoPanel = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(ColorBorder).
				Padding(1, 2)
)
View Source
var (
	TableHeader = lipgloss.NewStyle().
				Foreground(ColorMuted).
				Bold(true).
				PaddingRight(2)

	TableCell = lipgloss.NewStyle().
				PaddingRight(2)

	TableCellDim = lipgloss.NewStyle().
					Foreground(ColorDim).
					PaddingRight(2)
)

Functions

func Banner() string

func Centered

func Centered(width int, content string) string

func ContentWidth

func ContentWidth(termWidth int) int

func KeyBind

func KeyBind(key, label string) string

func KeyValue

func KeyValue(key, value string) string

func MaskEmail

func MaskEmail(email string) string

MaskEmail replaces the local part of an email with stars for display. e.g. "user@gmail.com" -> "u***@gmail.com"

func RunConfirm

func RunConfirm(message, expected string) (bool, error)

RunConfirm shows a danger confirmation prompt and returns whether the user confirmed.

func RunProgress

func RunProgress(title string, steps []string, run func(p *ProgressRunner)) error

func RunWizard

func RunWizard(title string, fields []WizardField) ([]string, bool, error)

RunWizard runs a wizard and returns the values.

func StatusIcon

func StatusIcon(ok bool) string

func StatusText

func StatusText(status string) string

func Step

func Step(msg string) string

func StepResult

func StepResult(icon, msg string) string

Types

type ConfirmModel

type ConfirmModel struct {
	// contains filtered or unexported fields
}

func NewConfirm

func NewConfirm(message, expected string) ConfirmModel

func (ConfirmModel) Confirmed

func (m ConfirmModel) Confirmed() bool

func (ConfirmModel) Init

func (m ConfirmModel) Init() tea.Cmd

func (ConfirmModel) Update

func (m ConfirmModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ConfirmModel) View

func (m ConfirmModel) View() string

type ProgressDoneMsg

type ProgressDoneMsg struct{}

type ProgressModel

type ProgressModel struct {
	Steps []StepItem
	// contains filtered or unexported fields
}

func NewProgressModel

func NewProgressModel(title string) ProgressModel

func (ProgressModel) Init

func (m ProgressModel) Init() tea.Cmd

func (ProgressModel) Update

func (m ProgressModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ProgressModel) View

func (m ProgressModel) View() string

type ProgressRunner

type ProgressRunner struct {
	Result strings.Builder
	// contains filtered or unexported fields
}

func (*ProgressRunner) Done

func (r *ProgressRunner) Done(index int, detail string)

func (*ProgressRunner) Fail

func (r *ProgressRunner) Fail(index int, detail string)

func (*ProgressRunner) Print

func (r *ProgressRunner) Print(s string)

func (*ProgressRunner) Start

func (r *ProgressRunner) Start(index int)

func (*ProgressRunner) SubRow

func (r *ProgressRunner) SubRow(index int, row string)

func (*ProgressRunner) Warn

func (r *ProgressRunner) Warn(index int, detail string)

type StepAddSubRowMsg

type StepAddSubRowMsg struct {
	Index int
	Row   string
}

type StepFunc

type StepFunc func(send func(tea.Msg)) error

type StepItem

type StepItem struct {
	Label   string
	Status  StepStatus
	Detail  string
	SubRows []string
}

type StepStatus

type StepStatus int
const (
	StepPending StepStatus = iota
	StepRunning
	StepDone
	StepWarn
	StepFail
)

type StepUpdateMsg

type StepUpdateMsg struct {
	Index  int
	Status StepStatus
	Detail string
}

type WizardField

type WizardField struct {
	Label       string
	Help        string
	Placeholder string
	Password    bool
	Value       string
}

type WizardModel

type WizardModel struct {
	// contains filtered or unexported fields
}

func NewWizard

func NewWizard(title string, fields []WizardField) WizardModel

func (WizardModel) Completed

func (m WizardModel) Completed() bool

func (WizardModel) Init

func (m WizardModel) Init() tea.Cmd

func (WizardModel) Update

func (m WizardModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (WizardModel) Values

func (m WizardModel) Values() []string

func (WizardModel) View

func (m WizardModel) View() string

Jump to

Keyboard shortcuts

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