Documentation
¶
Overview ¶
Package styles provides lipgloss styles for the TUI.
Index ¶
- Constants
- Variables
- func AlertSourceIcon(source string) string
- func AlertSourceName(source string) string
- func HighlightJSON(jsonStr string) string
- func RenderAlertSource(source string) string
- func RenderEmail(email string) string
- func RenderHelpItem(key, desc string) string
- func RenderLink(url, text string) string
- func RenderMarkdown(text string, width int) string
- func RenderMetric(value string) string
- func RenderNameWithEmail(name, email string) string
- func RenderScheduledMaintenance() string
- func RenderSeverity(severity string) string
- func RenderSeveritySignal(severity string) string
- func RenderStatus(status string) string
- func RenderStatusDot(status string) string
- func RenderURL(url string) string
Constants ¶
const ( SpacingNone = 0 SpacingSmall = 1 SpacingMedium = 2 SpacingLarge = 3 )
Spacing constants (padding and margin)
Variables ¶
var ( ColorPrimary = lipgloss.Color("#7C3AED") // Purple ColorPurple = lipgloss.Color("#7C3AED") // Alias for Primary ColorSecondary = lipgloss.Color("#6366F1") // Indigo ColorSuccess = lipgloss.Color("#10B981") // Green ColorWarning = lipgloss.Color("#F59E0B") // Amber ColorDanger = lipgloss.Color("#EF4444") // Red ColorInfo = lipgloss.Color("#4D96FF") // Blue ColorMuted = lipgloss.Color("#6B7280") // Gray ColorDisabled = lipgloss.Color("#4B5563") // Darker gray ColorText = lipgloss.Color("#F9FAFB") // Light ColorTextDim = lipgloss.Color("#9CA3AF") // Dimmed ColorBackground = lipgloss.Color("#1F2937") // Dark ColorBorder = lipgloss.Color("#374151") // Border gray ColorHighlight = lipgloss.Color("#8B5CF6") // Lighter purple )
Color palette (Rootly brand colors)
var ( ColorPastelRed = lipgloss.Color("#F87171") // Soft red ColorPastelYellow = lipgloss.Color("#FBBF24") // Soft amber ColorPastelGreen = lipgloss.Color("#34D399") // Soft green ColorPastelGray = lipgloss.Color("#9CA3AF") // Soft gray )
Pastel colors for status text
var ( ColorCritical = lipgloss.Color("#DC2626") // Dark red ColorHigh = lipgloss.Color("#EA580C") // Orange ColorMedium = lipgloss.Color("#CA8A04") // Yellow ColorLow = lipgloss.Color("#2563EB") // Blue )
Severity colors
var ( Primary = lipgloss.NewStyle().Foreground(ColorPrimary) Secondary = lipgloss.NewStyle().Foreground(ColorSecondary) Success = lipgloss.NewStyle().Foreground(ColorSuccess) Warning = lipgloss.NewStyle().Foreground(ColorWarning) Danger = lipgloss.NewStyle().Foreground(ColorDanger) Info = lipgloss.NewStyle().Foreground(ColorInfo) Muted = lipgloss.NewStyle().Foreground(ColorMuted) Text = lipgloss.NewStyle().Foreground(ColorText) TextDim = lipgloss.NewStyle().Foreground(ColorTextDim) TextBold = lipgloss.NewStyle().Foreground(ColorText).Bold(true) )
Text styles
var ( App = lipgloss.NewStyle(). Padding(SpacingSmall, SpacingMedium) Header = lipgloss.NewStyle(). Bold(true). Foreground(ColorText). Padding(SpacingNone, SpacingMedium). MarginBottom(SpacingSmall) Title = lipgloss.NewStyle(). Bold(true). Foreground(ColorText) // Tab styles TabActive = lipgloss.NewStyle(). Bold(true). Foreground(ColorPrimary). Underline(true). Padding(SpacingNone, SpacingMedium) TabInactive = lipgloss.NewStyle(). Foreground(ColorTextDim). Padding(SpacingNone, SpacingMedium) // List styles ListContainer = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorBorder). Padding(SpacingNone, SpacingSmall) ListItem = lipgloss.NewStyle(). Foreground(ColorText). Padding(SpacingNone, SpacingSmall) ListItemSelected = lipgloss.NewStyle(). Foreground(ColorHighlight). Bold(true). Padding(SpacingNone, SpacingSmall) // Detail pane styles DetailContainer = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorBorder). Padding(SpacingSmall, SpacingMedium) DetailContainerFocused = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorPrimary). Padding(SpacingSmall, SpacingMedium) DetailTitle = lipgloss.NewStyle(). Bold(true). Foreground(ColorPrimary). MarginBottom(SpacingSmall) DetailLabel = lipgloss.NewStyle(). Foreground(ColorTextDim). Width(15) DetailValue = lipgloss.NewStyle(). Foreground(ColorText) // Status styles (pastel text colors, no background) StatusActive = lipgloss.NewStyle(). Foreground(ColorPastelRed) StatusInProgress = lipgloss.NewStyle(). Foreground(ColorPastelYellow) StatusResolved = lipgloss.NewStyle(). Foreground(ColorPastelGreen) StatusMuted = lipgloss.NewStyle(). Foreground(ColorPastelGray) // Severity badges SeverityCritical = lipgloss.NewStyle(). Foreground(ColorText). Background(ColorCritical). Padding(SpacingNone, SpacingSmall). Bold(true) SeverityHigh = lipgloss.NewStyle(). Foreground(ColorText). Background(ColorHigh). Padding(SpacingNone, SpacingSmall). Bold(true) SeverityMedium = lipgloss.NewStyle(). Foreground(lipgloss.Color("#000000")). Background(ColorMedium). Padding(SpacingNone, SpacingSmall). Bold(true) SeverityLow = lipgloss.NewStyle(). Foreground(ColorText). Background(ColorLow). Padding(SpacingNone, SpacingSmall). Bold(true) // Input styles InputLabel = lipgloss.NewStyle(). Foreground(ColorText). Bold(true). MarginBottom(SpacingSmall) InputField = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorBorder). Padding(SpacingNone, SpacingSmall). Width(46) InputFieldFocused = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorPrimary). Padding(SpacingNone, SpacingSmall). Width(46) // Button styles Button = lipgloss.NewStyle(). Foreground(ColorText). Background(ColorMuted). Padding(SpacingNone, SpacingMedium). MarginRight(SpacingSmall) ButtonFocused = lipgloss.NewStyle(). Foreground(ColorText). Background(ColorPrimary). Padding(SpacingNone, SpacingMedium). MarginRight(SpacingSmall) ButtonDisabled = lipgloss.NewStyle(). Foreground(ColorTextDim). Background(ColorDisabled). Padding(SpacingNone, SpacingMedium). MarginRight(SpacingSmall) // Dialog styles Dialog = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorPrimary). Padding(SpacingMedium, SpacingLarge+SpacingSmall). Width(60) DialogTitle = lipgloss.NewStyle(). Bold(true). Foreground(ColorPrimary). MarginBottom(SpacingSmall) // Help bar HelpBar = lipgloss.NewStyle(). Foreground(ColorTextDim). MarginTop(SpacingSmall) HelpKey = lipgloss.NewStyle(). Foreground(ColorPrimary). Bold(true) HelpDesc = lipgloss.NewStyle(). Foreground(ColorTextDim) // Status bar StatusBar = lipgloss.NewStyle(). Foreground(ColorTextDim). MarginTop(SpacingSmall) // Error/Success messages Error = lipgloss.NewStyle(). Foreground(ColorDanger). Bold(true) SuccessMsg = lipgloss.NewStyle(). Foreground(ColorSuccess). Bold(true) // Spinner Spinner = lipgloss.NewStyle(). Foreground(ColorPrimary) // Status indicators DotActive = lipgloss.NewStyle(). Foreground(ColorSuccess). SetString("●") DotWarning = lipgloss.NewStyle(). Foreground(ColorWarning). SetString("●") DotDanger = lipgloss.NewStyle(). Foreground(ColorDanger). SetString("●") DotMuted = lipgloss.NewStyle(). Foreground(ColorMuted). SetString("○") )
Layout styles
var ( SignalCritical = lipgloss.NewStyle().Foreground(ColorCritical).Bold(true) SignalHigh = lipgloss.NewStyle().Foreground(ColorHigh).Bold(true) SignalMedium = lipgloss.NewStyle().Foreground(ColorMedium).Bold(true) SignalLow = lipgloss.NewStyle().Foreground(ColorLow).Bold(true) )
Signal bar severity indicators
var ( MetricValue = lipgloss.NewStyle(). Foreground(lipgloss.Color("#10B981")). Bold(true) MetricLabel = lipgloss.NewStyle(). Foreground(ColorTextDim) )
Metric styles for duration display
var ScheduledMaintenance = lipgloss.NewStyle(). Foreground(lipgloss.Color("#FFFFFF")). Background(lipgloss.Color("#6366F1")). Padding(0, 1). Bold(true)
ScheduledMaintenance badge style
Functions ¶
func AlertSourceIcon ¶
AlertSourceIcon returns just the emoji icon for an alert source
func AlertSourceName ¶
AlertSourceName returns the human-readable name for an alert source
func HighlightJSON ¶ added in v0.2.0
HighlightJSON applies syntax highlighting to JSON string. It parses the JSON character by character and applies appropriate colors for keys, strings, numbers, booleans, null, and punctuation.
func RenderAlertSource ¶
func RenderEmail ¶
RenderEmail renders an email as a clickable mailto link
func RenderHelpItem ¶
func RenderLink ¶
RenderLink renders a clickable hyperlink using OSC 8 escape sequences Most modern terminals support this (iTerm2, Kitty, Windows Terminal, etc.)
func RenderMarkdown ¶
RenderMarkdown renders markdown text for terminal display using glamour Falls back to plain text if rendering fails
func RenderMetric ¶ added in v0.2.0
RenderMetric renders a metric value with optional styling
func RenderNameWithEmail ¶
RenderNameWithEmail renders a name with email in format "Name [email]" where email is clickable
func RenderScheduledMaintenance ¶ added in v0.2.0
func RenderScheduledMaintenance() string
RenderScheduledMaintenance renders a scheduled maintenance badge
func RenderSeverity ¶
func RenderSeveritySignal ¶
RenderSeveritySignal renders severity as signal bars (▁▃▅▇)
func RenderStatus ¶
func RenderStatusDot ¶
Types ¶
This section is empty.