styles

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorIcon    = "✗"
	SuccessIcon  = "✓"
	WarningIcon  = "▲"
	InfoIcon     = "ⓘ"
	ProgressIcon = "●"
)

Message icons for different types

View Source
const ASCIITitleTemplate = `` /* 282-byte string literal not displayed */

ASCII title template

Variables

View Source
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

View Source
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

View Source
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

View Source
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

View Source
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

View Source
var TableAltRowStyle = lipgloss.NewStyle().
	Foreground(White).
	Background(GrayBlue).
	Padding(0, 1)

TableAltRowStyle is used for odd table rows.

View Source
var TableHeaderStyle = lipgloss.NewStyle().
	Foreground(White).
	Background(VSCodeBlue).
	Bold(true).
	Padding(0, 1)

TableHeaderStyle is used for table headers.

View Source
var TableRowStyle = lipgloss.NewStyle().
	Foreground(White).
	Background(DarkGray).
	Padding(0, 1)

TableRowStyle is used for even table rows.

View Source
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"},
}
View Source
var VSCodeIcons = []VSCodeIcon{}/* 518 elements not displayed */

Functions

func PrintError

func PrintError(message string)

PrintError prints an error message with icon

func PrintInfo

func PrintInfo(message string)

PrintInfo prints an info message with icon

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

func RenderBlurredButton(text string) string

Renders a not focused button with text

func RenderDangerButton

func RenderDangerButton(text string) string

func RenderErrorMessage

func RenderErrorMessage(content string, maxWidth int) string

RenderErrorMessage renders a styled error message with container. maxWidth caps the container width so it fits narrow terminals; 0 uses the default.

func RenderFocusedButton

func RenderFocusedButton(text string) string

Renders a focused button with text

func RenderInfoMessage

func RenderInfoMessage(content string, maxWidth int) string

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 RenderSuccessButton(text string) string

func RenderSuccessMessage

func RenderSuccessMessage(content string, maxWidth int) string

RenderSuccessMessage renders a styled success message with container. maxWidth caps the container width so it fits narrow terminals; 0 uses the default.

func RenderTaskStatus

func RenderTaskStatus(name string, icon string, success bool) string

RenderTaskStatus renders a task with its status

func RenderTitle

func RenderTitle(title string) string

RenderTitle renders a title with ASCII box border and proper centering.

func RenderWarningMessage

func RenderWarningMessage(content string, maxWidth int) string

RenderWarningMessage renders a styled warning message with container. maxWidth caps the container width so it fits narrow terminals; 0 uses the default.

func ResponsiveContainerWidth

func ResponsiveContainerWidth(terminalWidth, fallback, horizontalMargin int) int

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

type VSCodeANSIColor struct {
	Name string
	Desc string
}

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

type VSCodeIcon struct {
	Name string
	Desc string
}

func (VSCodeIcon) Description

func (i VSCodeIcon) Description() string

func (VSCodeIcon) FilterValue

func (i VSCodeIcon) FilterValue() string

func (VSCodeIcon) Title

func (i VSCodeIcon) Title() string

Jump to

Keyboard shortcuts

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