Documentation
¶
Overview ¶
Package theme provides centralized styling, colors, and formatting for the TUI.
Index ¶
- Constants
- Variables
- func BorderColorError() lipgloss.Color
- func BorderColorFocused() lipgloss.Color
- func BorderColorSuccess() lipgloss.Color
- func BorderColorUnfocused() lipgloss.Color
- func CompactString(s string) string
- func FormatCost(cost float64) string
- func FormatDuration(d time.Duration) string
- func FormatNumber(n int64) string
- func FormatPercentage(numerator, denominator int) string
- func TruncateString(s string, maxLen int) string
Constants ¶
const ( // ColorPrimary is the primary brand color ColorPrimary = "#7C3AED" // ColorDarkBg is the dark background color ColorDarkBg = "#1E1E2E" // ColorSuccess indicates successful operations ColorSuccess = "#10B981" // ColorInfo indicates informational states ColorInfo = "#3B82F6" // ColorLightBlue is a lighter blue shade ColorLightBlue = "#60A5FA" // ColorError indicates error states ColorError = "#EF4444" // ColorWarning indicates warning states ColorWarning = "#F59E0B" // ColorYellow is yellow ColorYellow = "#FBBF24" // ColorGray is the standard gray color ColorGray = "#6B7280" // ColorLightGray is a lighter gray shade ColorLightGray = "#9CA3AF" // ColorWhite is white ColorWhite = "#F3F4F6" // ColorIndigo is an indigo shade ColorIndigo = "#6366F1" // ColorViolet is a violet shade ColorViolet = "#A78BFA" // ColorEmerald is an emerald shade ColorEmerald = "#34D399" // ColorSky is a sky blue shade ColorSky = "#93C5FD" )
Color palette for the TUI
const ( // PercentageMultiplier converts ratio to percentage PercentageMultiplier = 100 // MinEllipsisLength is the minimum length to show ellipsis MinEllipsisLength = 3 // ThousandSeparatorInterval is the digit count between thousand separators ThousandSeparatorInterval = 3 )
const ( // BoxPaddingHorizontal is the horizontal padding for bordered boxes BoxPaddingHorizontal = 2 // BoxPaddingVertical is the vertical padding for bordered boxes BoxPaddingVertical = 1 )
Variables ¶
var ( // TitleStyle is used for section titles TitleStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color(ColorPrimary)) // SuccessStyle indicates successful operations SuccessStyle = lipgloss.NewStyle().Foreground(lipgloss.Color(ColorSuccess)).Bold(true) // ErrorStyle indicates error states ErrorStyle = lipgloss.NewStyle().Foreground(lipgloss.Color(ColorError)).Bold(true) // WarningStyle indicates warning states WarningStyle = lipgloss.NewStyle().Foreground(lipgloss.Color(ColorWarning)).Bold(true) // InfoStyle indicates informational states InfoStyle = lipgloss.NewStyle().Foreground(lipgloss.Color(ColorInfo)) // LabelStyle is used for labels LabelStyle = lipgloss.NewStyle().Foreground(lipgloss.Color(ColorLightGray)) // ValueStyle is used for values ValueStyle = lipgloss.NewStyle().Foreground(lipgloss.Color(ColorWhite)).Bold(true) // BorderedBoxStyle is a box with rounded borders and padding BorderedBoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). Padding(BoxPaddingVertical, BoxPaddingHorizontal) // SubtleTextStyle is used for less prominent text SubtleTextStyle = lipgloss.NewStyle().Foreground(lipgloss.Color(ColorGray)) )
Functions ¶
func BorderColorError ¶
BorderColorError returns the border color for error states
func BorderColorFocused ¶
BorderColorFocused returns the border color for focused elements
func BorderColorSuccess ¶
BorderColorSuccess returns the border color for success states
func BorderColorUnfocused ¶
BorderColorUnfocused returns the border color for unfocused elements
func CompactString ¶
CompactString removes excess whitespace from a string
func FormatCost ¶
FormatCost formats a cost value as currency (e.g., "$0.0123")
func FormatDuration ¶
FormatDuration formats a duration as a human-readable string (e.g., "500ms", "2s")
func FormatNumber ¶
FormatNumber formats a large number with thousand separators (e.g., "1,234,567")
func FormatPercentage ¶
FormatPercentage formats a ratio as a percentage (e.g., "66.7%")
func TruncateString ¶
TruncateString truncates a string to maxLen characters with ellipsis
Types ¶
This section is empty.