theme

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package theme provides theming support with built-in and custom themes.

Index

Constants

View Source
const (
	ThemeDefault      = "default"
	ThemeNord         = "nord"
	ThemeDracula      = "dracula"
	ThemeGruvbox      = "gruvbox"
	ThemeCatppuccin   = "catppuccin"
	ThemeTokyoNight   = "tokyonight"
	ThemeSolarized    = "solarized"
	ThemeHighContrast = "highcontrast"
)

Built-in theme names

Variables

This section is empty.

Functions

func BuiltinThemeNames

func BuiltinThemeNames() []string

BuiltinThemeNames returns a list of all built-in theme names.

func BuiltinThemes

func BuiltinThemes() map[string]*Theme

BuiltinThemes returns all available built-in themes. The map is cached after first initialization.

func SaveThemeTemplate

func SaveThemeTemplate(dir string) error

SaveThemeTemplate saves a template theme file for user customization.

func SeverityName

func SeverityName(severity int) string

SeverityName returns the human-readable name for a severity level.

Types

type ColorPalette

type ColorPalette struct {
	// Severity colors (aligned with Zabbix severity levels)
	Disaster      lipgloss.TerminalColor // Severity 5 - Critical/Disaster
	High          lipgloss.TerminalColor // Severity 4 - High
	Average       lipgloss.TerminalColor // Severity 3 - Average
	Warning       lipgloss.TerminalColor // Severity 2 - Warning
	Information   lipgloss.TerminalColor // Severity 1 - Information
	NotClassified lipgloss.TerminalColor // Severity 0 - Not classified

	// Status colors
	OK          lipgloss.TerminalColor // Healthy/resolved state
	Unknown     lipgloss.TerminalColor // Unknown status
	Maintenance lipgloss.TerminalColor // Under maintenance

	// UI colors
	Primary       lipgloss.TerminalColor // Primary accent, focused elements
	Secondary     lipgloss.TerminalColor // Secondary accent
	Background    lipgloss.TerminalColor // Main background
	Foreground    lipgloss.TerminalColor // Main text color
	Muted         lipgloss.TerminalColor // Subtle text, disabled elements
	Border        lipgloss.TerminalColor // Unfocused borders
	FocusedBorder lipgloss.TerminalColor // Focused pane borders
	Highlight     lipgloss.TerminalColor // Selected/highlighted items
	Surface       lipgloss.TerminalColor // Elevated surfaces (modals, etc.)
}

ColorPalette defines all colors used throughout the application. Colors are organized by semantic meaning to ensure consistent theming.

func (ColorPalette) SeverityColor

func (c ColorPalette) SeverityColor(severity int) lipgloss.TerminalColor

SeverityColor returns the appropriate color for a Zabbix severity level (0-5).

type CustomColorConfig

type CustomColorConfig struct {
	// Severity colors
	Disaster      string `yaml:"disaster"`
	High          string `yaml:"high"`
	Average       string `yaml:"average"`
	Warning       string `yaml:"warning"`
	Information   string `yaml:"information"`
	NotClassified string `yaml:"not_classified"`

	// Status colors
	OK          string `yaml:"ok"`
	Unknown     string `yaml:"unknown"`
	Maintenance string `yaml:"maintenance"`

	// UI colors
	Primary       string `yaml:"primary"`
	Secondary     string `yaml:"secondary"`
	Background    string `yaml:"background"`
	Foreground    string `yaml:"foreground"`
	Muted         string `yaml:"muted"`
	Border        string `yaml:"border"`
	FocusedBorder string `yaml:"focused_border"`
	Highlight     string `yaml:"highlight"`
	Surface       string `yaml:"surface"`
}

CustomColorConfig holds color hex values from a custom theme file.

type CustomThemeConfig

type CustomThemeConfig struct {
	Name        string            `yaml:"name"`
	Description string            `yaml:"description"`
	Colors      CustomColorConfig `yaml:"colors"`
}

CustomThemeConfig represents a custom theme loaded from YAML.

type Styles

type Styles struct {
	// Base styles
	App    lipgloss.Style
	Title  lipgloss.Style
	Subtle lipgloss.Style

	// Pane styles
	PaneFocused  lipgloss.Style
	PaneBlurred  lipgloss.Style
	PaneTitle    lipgloss.Style
	PaneSubtitle lipgloss.Style

	// Status bar styles
	StatusBar     lipgloss.Style
	StatusOK      lipgloss.Style
	StatusProblem lipgloss.Style
	StatusUnknown lipgloss.Style
	StatusMaint   lipgloss.Style
	StatusFilter  lipgloss.Style

	// Alert list styles
	AlertSelected lipgloss.Style
	AlertNormal   lipgloss.Style
	AlertSeverity [6]lipgloss.Style // Index 0-5 for severity levels
	AlertHost     lipgloss.Style
	AlertName     lipgloss.Style
	AlertDuration lipgloss.Style
	AlertAcked    lipgloss.Style

	// Detail pane styles
	DetailLabel lipgloss.Style
	DetailValue lipgloss.Style
	DetailTag   lipgloss.Style

	// Tab styles
	TabActive   lipgloss.Style
	TabInactive lipgloss.Style
	TabBar      lipgloss.Style

	// Command input styles
	CommandPrompt lipgloss.Style
	CommandInput  lipgloss.Style
	CommandHint   lipgloss.Style

	// Modal styles
	ModalBackground lipgloss.Style
	ModalBox        lipgloss.Style
	ModalTitle      lipgloss.Style
	ModalText       lipgloss.Style
	ModalButton     lipgloss.Style
	ModalButtonAlt  lipgloss.Style

	// Help styles
	HelpKey  lipgloss.Style
	HelpDesc lipgloss.Style
}

Styles contains pre-built lipgloss styles derived from a theme. These are computed once when a theme is loaded for performance.

func NewStyles

func NewStyles(t *Theme) *Styles

NewStyles creates a Styles struct from a Theme.

type Theme

type Theme struct {
	Name        string
	Description string
	Colors      ColorPalette
}

Theme contains all styling information for the application.

func CatppuccinTheme

func CatppuccinTheme() *Theme

CatppuccinTheme returns the Catppuccin Mocha color theme. https://github.com/catppuccin/catppuccin

func DefaultTheme

func DefaultTheme() *Theme

DefaultTheme returns the default Zabbix-inspired theme.

func DraculaTheme

func DraculaTheme() *Theme

DraculaTheme returns the Dracula color theme. https://draculatheme.com/

func GruvboxTheme

func GruvboxTheme() *Theme

GruvboxTheme returns the Gruvbox dark color theme. https://github.com/morhetz/gruvbox

func HighContrastTheme added in v0.5.0

func HighContrastTheme() *Theme

HighContrastTheme returns a WCAG AAA compliant high contrast theme. Inspired by Modus Vivendi (https://protesilaos.com/emacs/modus-themes) All color combinations meet WCAG AAA (7:1 contrast ratio) for accessibility.

func Load

func Load(name, configDir string) (*Theme, error)

Load attempts to load a theme by name. It first checks built-in themes, then looks for custom theme files.

func LoadFromFile

func LoadFromFile(path string) (*Theme, error)

LoadFromFile loads a custom theme from a YAML file.

func NordTheme

func NordTheme() *Theme

NordTheme returns the Nord color theme. https://www.nordtheme.com/

func SolarizedTheme

func SolarizedTheme() *Theme

SolarizedTheme returns the Solarized dark color theme. https://ethanschoonover.com/solarized/

func TokyoNightTheme

func TokyoNightTheme() *Theme

TokyoNightTheme returns the Tokyo Night color theme. https://github.com/folke/tokyonight.nvim

Jump to

Keyboard shortcuts

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