styles

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package styles provides consistent styling for the go-mink CLI. It defines colors, fonts, and reusable style components for a beautiful UI.

Index

Constants

View Source
const (
	IconSuccess  = "✓"
	IconError    = "✗"
	IconWarning  = "⚠"
	IconInfo     = "ℹ"
	IconArrow    = "→"
	IconDot      = "•"
	IconCheck    = "✔"
	IconCross    = "✘"
	IconStar     = "★"
	IconHeart    = "♥"
	IconSparkle  = "✨"
	IconRocket   = "🚀"
	IconPackage  = "📦"
	IconFolder   = "📁"
	IconFile     = "📄"
	IconDatabase = "🗄️"
	IconGear     = "⚙️"
	IconLock     = "🔒"
	IconKey      = "🔑"
	IconMink     = "🦫" // Mink emoji (beaver closest match)
)

Icons - using Unicode symbols for beautiful indicators

View Source
const (
	IconPending = "◌"
	IconStream  = "⇶"
	IconList    = "☰"
	IconChart   = "📊"
	IconHealth  = "❤️"
)

Additional icons

Variables

View Source
var (
	// Primary colors
	Primary       = lipgloss.Color("#7C3AED") // Vibrant purple
	PrimaryLight  = lipgloss.Color("#A78BFA") // Light purple
	PrimaryDark   = lipgloss.Color("#5B21B6") // Dark purple
	Secondary     = lipgloss.Color("#06B6D4") // Cyan
	SecondaryDark = lipgloss.Color("#0891B2") // Dark cyan

	// Status colors
	Success      = lipgloss.Color("#10B981") // Emerald green
	SuccessLight = lipgloss.Color("#34D399") // Light green
	Warning      = lipgloss.Color("#F59E0B") // Amber
	WarningLight = lipgloss.Color("#FBBF24") // Light amber
	Error        = lipgloss.Color("#EF4444") // Red
	ErrorLight   = lipgloss.Color("#F87171") // Light red
	Info         = lipgloss.Color("#3B82F6") // Blue
	InfoLight    = lipgloss.Color("#60A5FA") // Light blue

	// Neutral colors
	Text       = lipgloss.Color("#F9FAFB") // Almost white
	TextMuted  = lipgloss.Color("#9CA3AF") // Gray
	TextDim    = lipgloss.Color("#6B7280") // Darker gray
	Background = lipgloss.Color("#111827") // Dark background
	Surface    = lipgloss.Color("#1F2937") // Slightly lighter
	Border     = lipgloss.Color("#374151") // Border gray

	// Accent colors for variety
	Accent1 = lipgloss.Color("#EC4899") // Pink
	Accent2 = lipgloss.Color("#8B5CF6") // Purple
	Accent3 = lipgloss.Color("#14B8A6") // Teal
)

Color palette - carefully chosen for accessibility and aesthetics

View Source
var (
	// Bold text in primary color
	Bold = lipgloss.NewStyle().
			Bold(true)

	// Title style for headers
	Title = lipgloss.NewStyle().
			Bold(true).
			Foreground(Primary).
			MarginBottom(1)

	// Subtitle for secondary headers
	Subtitle = lipgloss.NewStyle().
				Bold(true).
				Foreground(PrimaryLight)

	// Normal text
	Normal = lipgloss.NewStyle().
			Foreground(Text)

	// Muted text for less important info
	Muted = lipgloss.NewStyle().
			Foreground(TextMuted)

	// Dim text for very subtle info
	Dim = lipgloss.NewStyle().
		Foreground(TextDim)

	// Highlight for important text
	Highlight = lipgloss.NewStyle().
				Bold(true).
				Foreground(Secondary)

	// Code style for inline code
	Code = lipgloss.NewStyle().
			Foreground(WarningLight).
			Background(Surface).
			Padding(0, 1)
)

Text styles

View Source
var (
	SuccessStyle = newStatusStyle(Success)     // SuccessStyle for success messages
	SuccessBold  = newStatusBoldStyle(Success) // SuccessBold for emphasized success
	WarningStyle = newStatusStyle(Warning)     // WarningStyle for warning messages
	WarningBold  = newStatusBoldStyle(Warning) // WarningBold for emphasized warnings
	ErrorStyle   = newStatusStyle(Error)       // ErrorStyle for error messages
	ErrorBold    = newStatusBoldStyle(Error)   // ErrorBold for emphasized errors
	InfoStyle    = newStatusStyle(Info)        // InfoStyle for informational messages
	InfoBold     = newStatusBoldStyle(Info)    // InfoBold for emphasized info
)

Status styles - using helper functions to reduce duplication

View Source
var (
	Box          = newRoundedBox(Border)  // Box with a subtle border
	BoxHighlight = newRoundedBox(Primary) // BoxHighlight with primary color border
	BoxSuccess   = newRoundedBox(Success) // BoxSuccess with success color border
	BoxError     = newRoundedBox(Error)   // BoxError with error color border
	BoxWarning   = newRoundedBox(Warning) // BoxWarning with warning color border
)

Box styles for containers

View Source
var (
	// MenuItem for menu items
	MenuItem = lipgloss.NewStyle().
				PaddingLeft(2)

	// MenuItemSelected for selected menu items
	MenuItemSelected = lipgloss.NewStyle().
						Foreground(Primary).
						Bold(true).
						PaddingLeft(2)

	// ListItem for list items
	ListItem = lipgloss.NewStyle().
				PaddingLeft(2).
				Foreground(Text)

	// ListItemBullet for list item bullets
	ListItemBullet = lipgloss.NewStyle().
					Foreground(Primary).
					PaddingRight(1)
)

Component styles

View Source
var (
	// Indent for indented text
	Indent = lipgloss.NewStyle().
			PaddingLeft(2)

	// DoubleIndent for double indented text
	DoubleIndent = lipgloss.NewStyle().
					PaddingLeft(4)

	// Section for section content
	Section = lipgloss.NewStyle().
			MarginTop(1).
			MarginBottom(1)
)

Layout helpers

View Source
var InfoBox = newRoundedBox(Info).MarginTop(1)

InfoBox style for information boxes

Functions

func DisableColors

func DisableColors()

DisableColors disables all colors for terminals that don't support them

func FormatError

func FormatError(msg string) string

FormatError formats an error message with icon

func FormatInfo

func FormatInfo(msg string) string

FormatInfo formats an info message with icon

func FormatKeyValue

func FormatKeyValue(key, value string) string

FormatKeyValue formats a key-value pair

func FormatStep

func FormatStep(step int, total int, msg string) string

FormatStep formats a step in a process

func FormatSuccess

func FormatSuccess(msg string) string

FormatSuccess formats a success message with icon

func FormatWarning

func FormatWarning(msg string) string

FormatWarning formats a warning message with icon

Types

This section is empty.

Jump to

Keyboard shortcuts

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