Documentation
¶
Index ¶
- Constants
- Variables
- func PrintError(message string)
- func PrintInfo(message string)
- func PrintProgress(message string)
- func PrintSuccess(message string)
- func PrintWarning(message string)
- func RenderBlurredButton(text string) string
- func RenderDangerButton(text string) string
- func RenderErrorMessage(content string, maxWidth int) string
- func RenderFocusedButton(text string) string
- func RenderInfoMessage(content string, maxWidth int) string
- func RenderSuccessButton(text string) string
- func RenderSuccessMessage(content string, maxWidth int) string
- func RenderTaskStatus(name string, icon string, success bool) string
- func RenderTitle(title string) string
- func RenderWarningMessage(content string, maxWidth int) string
- func ResponsiveContainerWidth(terminalWidth, fallback, horizontalMargin int) int
- type VSCodeANSIColor
- type VSCodeIcon
Constants ¶
const ( ErrorIcon = "✗" SuccessIcon = "✓" WarningIcon = "▲" InfoIcon = "ⓘ" ProgressIcon = "●" )
Message icons for different types
const ASCIITitleTemplate = `` /* 282-byte string literal not displayed */
ASCII title template
Variables ¶
var ( // Primary button (focused state) FocusedButton = lipgloss.NewStyle(). Foreground(White). Background(VSCodeBlue). Padding(0, 2) // Secondary button (blurred state) BlurredButton = lipgloss.NewStyle(). Foreground(LightGray). Border(lipgloss.NormalBorder()). BorderForeground(LightGray). Padding(0, 2) // Danger button for destructive actions DangerButton = lipgloss.NewStyle(). Foreground(White). Background(Error). Padding(0, 2) // Success button for positive actions SuccessButton = lipgloss.NewStyle(). Foreground(White). Background(Success). Padding(0, 2) )
Button styles for consistent UI
var ( // Primary colors VSCodeBlue = lipgloss.Color("#007ACC") // VSCode primary blue LightBlue = lipgloss.Color("#40A9FF") // Light blue accent GrayBlue = lipgloss.Color("#6A9FDB") // Muted blue for labels // Neutral colors DarkGray = lipgloss.Color("#3C3C3C") // VSCode dark gray LightGray = lipgloss.Color("#858585") // Light gray text White = lipgloss.Color("#FFFFFF") // Pure white // Semantic colors Success = lipgloss.Color("#4CAF50") // Green for success states Warning = lipgloss.Color("#FF9800") // Orange for warnings Error = lipgloss.Color("#F44336") // Red for errors )
Color palette inspired by VSCode and Go
var ( // Input field styles FocusedInputStyle = lipgloss.NewStyle(). Foreground(VSCodeBlue). Bold(true) BlurredInputStyle = lipgloss.NewStyle(). Foreground(LightGray) PlaceholderStyle = lipgloss.NewStyle(). Foreground(LightGray) // Label styles FieldLabelStyle = lipgloss.NewStyle(). Foreground(GrayBlue). Bold(true) // Container styles FieldContainerStyle = lipgloss.NewStyle(). MarginBottom(0) FormContainerStyle = lipgloss.NewStyle(). Padding(0, 1). MarginTop(1) // Help and navigation text HelpTextStyle = lipgloss.NewStyle(). Foreground(LightGray). MarginTop(1) // Suggestion styles SuggestionContainerStyle = lipgloss.NewStyle(). Background(lipgloss.Color("#1a1a1a")). Foreground(LightGray). Border(lipgloss.RoundedBorder()). BorderForeground(lipgloss.Color("#333333")). Padding(0, 1). MarginTop(0). Width(58) SuggestionItemStyle = lipgloss.NewStyle(). Foreground(LightGray). PaddingLeft(1) SuggestionHighlightStyle = lipgloss.NewStyle(). Foreground(VSCodeBlue). Bold(true). PaddingLeft(1) // Title styles TitleStyle = lipgloss.NewStyle(). Foreground(VSCodeBlue). Bold(true). MarginBottom(1) // Task selector specific styles. // Height is intentionally not set: a fixed Height on a bordered style clips // overflowing content. renderTaskList pads the list to a stable height instead. TaskSelectorContainerStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(GrayBlue). Padding(0, 1). Width(90) SelectedTaskStyle = lipgloss.NewStyle(). Foreground(VSCodeBlue). Bold(true) FocusedTaskStyle = lipgloss.NewStyle(). Background(lipgloss.Color("#2d2d2d")). Foreground(White). Bold(true) TextInputStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(GrayBlue). Padding(0, 1). Width(86) // Light gray style for text LightGrayStyle = lipgloss.NewStyle(). Foreground(LightGray) // UnfocusedInputStyle is a blank style used to reset input prompt and text styles when unfocused. UnfocusedInputStyle = lipgloss.NewStyle() // UnfocusedTaskStyle is a blank style used as the default for unselected, unfocused task items. UnfocusedTaskStyle = lipgloss.NewStyle() )
Form and input styles
var ( // Error message styles ErrorMessageStyle = lipgloss.NewStyle(). Foreground(Error). Bold(true). PaddingLeft(1) ErrorContainerStyle = lipgloss.NewStyle(). Background(lipgloss.Color("#2D1B1B")). Border(lipgloss.RoundedBorder()). BorderForeground(Error). Padding(0, 1). MarginBottom(1). Width(70) // Success message styles SuccessMessageStyle = lipgloss.NewStyle(). Foreground(Success). Bold(true). PaddingLeft(1) SuccessContainerStyle = lipgloss.NewStyle(). Background(lipgloss.Color("#1B2D1B")). Border(lipgloss.RoundedBorder()). BorderForeground(Success). Padding(0, 1). MarginBottom(1). Width(70) // Warning message styles WarningMessageStyle = lipgloss.NewStyle(). Foreground(Warning). Bold(true). PaddingLeft(1) WarningContainerStyle = lipgloss.NewStyle(). Background(lipgloss.Color("#2D241B")). Border(lipgloss.RoundedBorder()). BorderForeground(Warning). Padding(0, 1). MarginBottom(1). Width(70) // Info message styles InfoMessageStyle = lipgloss.NewStyle(). Foreground(VSCodeBlue). Bold(true). PaddingLeft(1) InfoContainerStyle = lipgloss.NewStyle(). Background(lipgloss.Color("#1B1F2D")). Border(lipgloss.RoundedBorder()). BorderForeground(VSCodeBlue). Padding(0, 1). MarginBottom(1). Width(70) )
Message styles for different types of notifications
var ( // Header styles RunnerHeaderStyle = lipgloss.NewStyle(). Foreground(VSCodeBlue). Bold(true). BorderStyle(lipgloss.NormalBorder()). BorderForeground(VSCodeBlue). BorderBottom(true). Padding(0, 1). MarginBottom(1) // Info and detail styles RunnerInfoStyle = lipgloss.NewStyle(). Foreground(LightGray). PaddingLeft(2) RunnerTaskNameStyle = lipgloss.NewStyle(). Foreground(White). Bold(true) // Status styles RunnerSuccessStyle = lipgloss.NewStyle(). Foreground(Success). Bold(true) RunnerErrorStyle = lipgloss.NewStyle(). Foreground(Error). Bold(true) RunnerWarningStyle = lipgloss.NewStyle(). Foreground(Warning). Bold(true) RunnerProgressStyle = lipgloss.NewStyle(). Foreground(LightBlue). Italic(true) // Icon styles RunnerIconStyle = lipgloss.NewStyle(). Foreground(VSCodeBlue) )
Runner output styles
var TableAltRowStyle = lipgloss.NewStyle(). Foreground(White). Background(GrayBlue). Padding(0, 1)
TableAltRowStyle is used for odd table rows.
var TableHeaderStyle = lipgloss.NewStyle(). Foreground(White). Background(VSCodeBlue). Bold(true). Padding(0, 1)
TableHeaderStyle is used for table headers.
var TableRowStyle = lipgloss.NewStyle(). Foreground(White). Background(DarkGray). Padding(0, 1)
TableRowStyle is used for even table rows.
var VSCodeANSIColors = []VSCodeANSIColor{
{Name: "terminal.ansiBlack", Desc: "Black"},
{Name: "terminal.ansiRed", Desc: "Red"},
{Name: "terminal.ansiGreen", Desc: "Green"},
{Name: "terminal.ansiYellow", Desc: "Yellow"},
{Name: "terminal.ansiBlue", Desc: "Blue"},
{Name: "terminal.ansiMagenta", Desc: "Magenta"},
{Name: "terminal.ansiCyan", Desc: "Cyan"},
{Name: "terminal.ansiWhite", Desc: "White"},
{Name: "terminal.ansiBrightBlack", Desc: "Bright Black"},
{Name: "terminal.ansiBrightRed", Desc: "Bright Red"},
{Name: "terminal.ansiBrightGreen", Desc: "Bright Green"},
{Name: "terminal.ansiBrightYellow", Desc: "Bright Yellow"},
{Name: "terminal.ansiBrightBlue", Desc: "Bright Blue"},
{Name: "terminal.ansiBrightMagenta", Desc: "Bright Magenta"},
{Name: "terminal.ansiBrightCyan", Desc: "Bright Cyan"},
{Name: "terminal.ansiBrightWhite", Desc: "Bright White"},
}
var VSCodeIcons = []VSCodeIcon{}/* 518 elements not displayed */
Functions ¶
func PrintProgress ¶
func PrintProgress(message string)
PrintProgress prints a progress message with icon
func PrintSuccess ¶
func PrintSuccess(message string)
PrintSuccess prints a success message with icon
func PrintWarning ¶
func PrintWarning(message string)
PrintWarning prints a warning message with icon
func RenderBlurredButton ¶
Renders a not focused button with text
func RenderDangerButton ¶
func RenderErrorMessage ¶
RenderErrorMessage renders a styled error message with container. maxWidth caps the container width so it fits narrow terminals; 0 uses the default.
func RenderFocusedButton ¶
Renders a focused button with text
func RenderInfoMessage ¶
RenderInfoMessage renders a styled info message with container. maxWidth caps the container width so it fits narrow terminals; 0 uses the default.
func RenderSuccessButton ¶
func RenderSuccessMessage ¶
RenderSuccessMessage renders a styled success message with container. maxWidth caps the container width so it fits narrow terminals; 0 uses the default.
func RenderTaskStatus ¶
RenderTaskStatus renders a task with its status
func RenderTitle ¶
RenderTitle renders a title with ASCII box border and proper centering.
func RenderWarningMessage ¶
RenderWarningMessage renders a styled warning message with container. maxWidth caps the container width so it fits narrow terminals; 0 uses the default.
func ResponsiveContainerWidth ¶
ResponsiveContainerWidth returns the width a bordered container should use so it fits the terminal. terminalWidth <= 0 (unknown) falls back to fallback; the result never grows past fallback nor drops below minContainerWidth. horizontalMargin reserves space for surrounding borders and padding.
Types ¶
type VSCodeANSIColor ¶
func (VSCodeANSIColor) Description ¶
func (c VSCodeANSIColor) Description() string
func (VSCodeANSIColor) FilterValue ¶
func (c VSCodeANSIColor) FilterValue() string
func (VSCodeANSIColor) Title ¶
func (c VSCodeANSIColor) Title() string
type VSCodeIcon ¶
func (VSCodeIcon) Description ¶
func (i VSCodeIcon) Description() string
func (VSCodeIcon) FilterValue ¶
func (i VSCodeIcon) FilterValue() string
func (VSCodeIcon) Title ¶
func (i VSCodeIcon) Title() string