styles

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package styles provides lipgloss styles for the TUI.

Index

Constants

View Source
const (
	SpacingNone   = 0
	SpacingSmall  = 1
	SpacingMedium = 2
	SpacingLarge  = 3
)

Spacing constants (padding and margin)

Variables

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

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

View Source
var (
	ColorCritical = lipgloss.Color("#DC2626") // Dark red
	ColorHigh     = lipgloss.Color("#EA580C") // Orange
	ColorMedium   = lipgloss.Color("#CA8A04") // Yellow
	ColorLow      = lipgloss.Color("#2563EB") // Blue
)

Severity colors

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

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

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

View Source
var (
	MetricValue = lipgloss.NewStyle().
				Foreground(lipgloss.Color("#10B981")).
				Bold(true)

	MetricLabel = lipgloss.NewStyle().
				Foreground(ColorTextDim)
)

Metric styles for duration display

View Source
var ScheduledMaintenance = lipgloss.NewStyle().
	Foreground(lipgloss.Color("#FFFFFF")).
	Background(lipgloss.Color("#6366F1")).
	Padding(0, 1).
	Bold(true)

ScheduledMaintenance badge style

Functions

func AlertSourceIcon

func AlertSourceIcon(source string) string

AlertSourceIcon returns just the emoji icon for an alert source

func AlertSourceName

func AlertSourceName(source string) string

AlertSourceName returns the human-readable name for an alert source

func HighlightJSON added in v0.2.0

func HighlightJSON(jsonStr string) string

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 RenderAlertSource(source string) string

func RenderEmail

func RenderEmail(email string) string

RenderEmail renders an email as a clickable mailto link

func RenderHelpItem

func RenderHelpItem(key, desc string) string
func RenderLink(url, text string) string

RenderLink renders a clickable hyperlink using OSC 8 escape sequences Most modern terminals support this (iTerm2, Kitty, Windows Terminal, etc.)

func RenderMarkdown

func RenderMarkdown(text string, width int) string

RenderMarkdown renders markdown text for terminal display using glamour Falls back to plain text if rendering fails

func RenderMetric added in v0.2.0

func RenderMetric(value string) string

RenderMetric renders a metric value with optional styling

func RenderNameWithEmail

func RenderNameWithEmail(name, email string) string

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 RenderSeverity(severity string) string

func RenderSeveritySignal

func RenderSeveritySignal(severity string) string

RenderSeveritySignal renders severity as signal bars (▁▃▅▇)

func RenderStatus

func RenderStatus(status string) string

func RenderStatusDot

func RenderStatusDot(status string) string

func RenderURL

func RenderURL(url string) string

RenderURL renders a URL as a clickable link (URL is both the link and display text)

Types

This section is empty.

Jump to

Keyboard shortcuts

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