ui

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SuccessSymbol    = "✓"
	ErrorSymbol      = "✗"
	InfoSymbol       = "ℹ"
	WarningSymbol    = "⚠"
	BulletSymbol     = "•"
	ArrowRightSymbol = "→"
	ArrowLeftSymbol  = "←"
	CheckmarkSymbol  = "✓"
	StartSymbol      = "○"
	EndSymbol        = "●"
	LoadingDots      = "..."
)

Enhanced symbols with consistent appearance.

View Source
const CommandPrompt = "❯"

Command prompt symbol.

Variables

View Source
var (
	// Primary colors.
	PrimaryColor   = "#7C3AED" // Vibrant purple
	SecondaryColor = "#2563EB" // Deep blue
	TertiaryColor  = "#10B981" // Emerald green

	// Status colors.
	SuccessColor  = "#10B981" // Emerald green
	ErrorColor    = "#EF4444" // Red
	WarningColor  = "#F59E0B" // Amber
	InfoColor     = "#3B82F6" // Blue
	RunningColor  = "#10B981" // Green for running status
	StoppedColor  = "#6B7280" // Gray for stopped status
	PendingColor  = "#F59E0B" // Amber for pending status
	UnloadedColor = "#9CA3AF" // Light gray for unloaded status

	// Text colors.
	HeaderColor  = "#F9FAFB" // Near white
	TextColor    = "#E5E7EB" // Light gray
	DimTextColor = "#9CA3AF" // Dimmed gray
	SubtleColor  = "#6B7280" // Very dim gray
	LinkColor    = "#60A5FA" // Light blue for links/actions
	AccentColor  = "#8B5CF6" // For backward compatibility
	SelectColor  = "#FFFFFF" // For backward compatibility

	// Border and accents.
	BorderColor        = "#374151" // Dark gray border
	HighlightColor     = "#8B5CF6" // Bright purple for highlights
	SelectionColor     = "#1F2937" // Dark blue-gray for selections
	BackgroundAccent   = "#111827" // Near black with blue tint
	AlternatingRowDark = "#1F2937" // Slightly lighter than background
)
View Source
var (
	// Base styles.
	BaseStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color(TextColor)).
				Padding(0, 0, 1, 2)

	HeaderStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color(HeaderColor)).
				Bold(true)

		// Semantic styles.
	SuccessStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color(SuccessColor))

	ErrorStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color(ErrorColor))

	WarningStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color(WarningColor))

	InfoStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color(InfoColor))

	DimStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color(DimTextColor))

	LinkStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color(LinkColor)).
				Underline(true)

		// For backwards compatibility.
	Highlight = lipgloss.NewStyle().
				Foreground(lipgloss.Color(AccentColor)).
				Bold(true)

	SelectStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color(SelectColor))

		// Component styles.
	TitleStyle = lipgloss.NewStyle().
				Foreground(lipgloss.Color(PrimaryColor)).
				Bold(true).
				MarginBottom(1)

	SubtitleStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color(SecondaryColor)).
					MarginBottom(1)

	SectionStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color(HeaderColor)).
					Bold(true).
					MarginTop(1).
					MarginBottom(1)

	BoxStyle = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(lipgloss.Color(BorderColor)).
				Padding(1).
				MarginTop(1).
				MarginBottom(1)

		// Table styles.
	TableHeaderStyle = lipgloss.NewStyle().
						Bold(true).
						Foreground(lipgloss.Color(HeaderColor))

	TableRowStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color(TextColor))

		// Status styles.
	RunningStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color(RunningColor))

	StoppedStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color(StoppedColor))

	PendingStyle = lipgloss.NewStyle().
					Foreground(lipgloss.Color(PendingColor))
)

Style definitions.

Functions

func CenterText

func CenterText(text string) string

Center text on the terminal line.

func PrintError

func PrintError(message string)

PrintError prints an error message with enhanced styling.

func PrintHighlight

func PrintHighlight(text string)

PrintHighlight prints highlighted text.

func PrintInfo

func PrintInfo(label, value string)

PrintInfo prints an info message with label and value in a cleaner format.

func PrintLogo()

PrintLogo prints the Ignition logo banner.

func PrintMetadata

func PrintMetadata(label, value string)

PrintMetadata prints metadata with styled label and value.

func PrintServiceLog

func PrintServiceLog(serviceName, logLine string)

PrintServiceLog prints a log line with a styled service name prefix.

func PrintSuccess

func PrintSuccess(message string)

PrintSuccess prints a success message with enhanced styling.

func PrintWarning

func PrintWarning(message string)

PrintWarning prints a warning message with enhanced styling.

func RenderTable

func RenderTable(table *Table) string

RenderTable renders the table with enhanced styling.

func StyleServiceName

func StyleServiceName(serviceName string) string

StyleServiceName styles a service name for log output.

func StyleStatusValue

func StyleStatusValue(status string) string

StyleStatusValue applies appropriate styling based on status value.

func TerminalWidth

func TerminalWidth() int

Terminal width detection (for responsive layouts).

Types

type Table

type Table struct {
	Headers     []string
	Rows        [][]string
	ColumnWidth []int
}

Table represents a formatted table with headers and rows.

func NewTable

func NewTable(headers []string) *Table

NewTable creates a new table with the given headers.

func (*Table) AddRow

func (t *Table) AddRow(values ...string)

AddRow adds a new row to the table.

Directories

Path Synopsis
models

Jump to

Keyboard shortcuts

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