styles

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package styles provides shared lipgloss styles for UI components.

This package centralizes color definitions and styling to ensure visual consistency across all UI components (static, progress, prompt, and wizard packages).

Index

Constants

This section is empty.

Variables

View Source
var (
	// Primary is the main accent color (cyan/teal)
	Primary color.Color = lipgloss.Color("62")

	// Accent is the highlight color for selected/active items (pink)
	Accent color.Color = lipgloss.Color("212")

	// Success is used for checkmarks and positive outcomes (green)
	Success color.Color = lipgloss.Color("82")

	// Error is used for error messages (red)
	Error color.Color = lipgloss.Color("196")

	// Muted is used for disabled/inactive text (gray)
	Muted color.Color = lipgloss.Color("240")

	// Normal is the standard text color (light gray)
	Normal color.Color = lipgloss.Color("252")

	// Info is used for informational text (gray)
	Info color.Color = lipgloss.Color("244")

	// Merged is used for merged PR indicators (purple)
	Merged color.Color = lipgloss.Color("135")
)

Primary colors used throughout the UI

View Source
var (
	// Bold applies bold formatting
	Bold = lipgloss.NewStyle().Bold(true)

	// Italic applies italic formatting
	Italic = lipgloss.NewStyle().Italic(true)

	// PrimaryStyle applies the primary color
	PrimaryStyle = lipgloss.NewStyle().Foreground(Primary)

	// AccentStyle applies the accent color with bold
	AccentStyle = lipgloss.NewStyle().
				Foreground(Accent).
				Bold(true)

	// SuccessStyle applies the success color
	SuccessStyle = lipgloss.NewStyle().Foreground(Success)

	// ErrorStyle applies the error color
	ErrorStyle = lipgloss.NewStyle().Foreground(Error)

	// MutedStyle applies the muted color
	MutedStyle = lipgloss.NewStyle().Foreground(Muted)

	// NormalStyle applies the normal text color
	NormalStyle = lipgloss.NewStyle().Foreground(Normal)

	// InfoStyle applies the info color with italic
	InfoStyle = lipgloss.NewStyle().
				Foreground(Info).
				Italic(true)

	// MergedStyle applies the merged color
	MergedStyle = lipgloss.NewStyle().Foreground(Merged)
)

Common styles

View Source
var (
	// DefaultTheme is the default color scheme (dark only)
	DefaultTheme = Theme{
		Primary: lipgloss.Color("62"),
		Accent:  lipgloss.Color("212"),
		Success: lipgloss.Color("82"),
		Error:   lipgloss.Color("196"),
		Muted:   lipgloss.Color("240"),
		Normal:  lipgloss.Color("252"),
		Info:    lipgloss.Color("244"),
	}

	// DraculaTheme is based on the Dracula color scheme (dark only)
	DraculaTheme = Theme{
		Primary: lipgloss.Color("#bd93f9"),
		Accent:  lipgloss.Color("#ff79c6"),
		Success: lipgloss.Color("#50fa7b"),
		Error:   lipgloss.Color("#ff5555"),
		Muted:   lipgloss.Color("#6272a4"),
		Normal:  lipgloss.Color("#f8f8f2"),
		Info:    lipgloss.Color("#8be9fd"),
	}

	// NordTheme is based on the Nord color scheme (dark)
	NordTheme = Theme{
		Primary: lipgloss.Color("#88c0d0"),
		Accent:  lipgloss.Color("#b48ead"),
		Success: lipgloss.Color("#a3be8c"),
		Error:   lipgloss.Color("#bf616a"),
		Muted:   lipgloss.Color("#4c566a"),
		Normal:  lipgloss.Color("#eceff4"),
		Info:    lipgloss.Color("#81a1c1"),
	}

	// GruvboxTheme is based on the Gruvbox color scheme (dark)
	GruvboxTheme = Theme{
		Primary: lipgloss.Color("#83a598"),
		Accent:  lipgloss.Color("#d3869b"),
		Success: lipgloss.Color("#b8bb26"),
		Error:   lipgloss.Color("#fb4934"),
		Muted:   lipgloss.Color("#665c54"),
		Normal:  lipgloss.Color("#ebdbb2"),
		Info:    lipgloss.Color("#8ec07c"),
	}

	// CatppuccinMochaTheme is based on Catppuccin Mocha (dark)
	CatppuccinMochaTheme = Theme{
		Primary: lipgloss.Color("#89b4fa"),
		Accent:  lipgloss.Color("#f5c2e7"),
		Success: lipgloss.Color("#a6e3a1"),
		Error:   lipgloss.Color("#f38ba8"),
		Muted:   lipgloss.Color("#6c7086"),
		Normal:  lipgloss.Color("#cdd6f4"),
		Info:    lipgloss.Color("#94e2d5"),
	}

	// NoneTheme renders without any colors (uses terminal defaults)
	// Formatting (bold/italic/underline) is preserved
	NoneTheme = Theme{
		Primary: lipgloss.NoColor{},
		Accent:  lipgloss.NoColor{},
		Success: lipgloss.NoColor{},
		Error:   lipgloss.NoColor{},
		Muted:   lipgloss.NoColor{},
		Normal:  lipgloss.NoColor{},
		Info:    lipgloss.NoColor{},
	}
)

Preset themes - Dark variants

View Source
var (
	// NordLightTheme is based on the Nord color scheme (light)
	NordLightTheme = Theme{
		Primary: lipgloss.Color("#5e81ac"),
		Accent:  lipgloss.Color("#b48ead"),
		Success: lipgloss.Color("#a3be8c"),
		Error:   lipgloss.Color("#bf616a"),
		Muted:   lipgloss.Color("#9a9a9a"),
		Normal:  lipgloss.Color("#2e3440"),
		Info:    lipgloss.Color("#81a1c1"),
	}

	// GruvboxLightTheme is based on the Gruvbox color scheme (light)
	GruvboxLightTheme = Theme{
		Primary: lipgloss.Color("#076678"),
		Accent:  lipgloss.Color("#8f3f71"),
		Success: lipgloss.Color("#79740e"),
		Error:   lipgloss.Color("#9d0006"),
		Muted:   lipgloss.Color("#928374"),
		Normal:  lipgloss.Color("#3c3836"),
		Info:    lipgloss.Color("#427b58"),
	}

	// CatppuccinLatteTheme is based on Catppuccin Latte (light)
	CatppuccinLatteTheme = Theme{
		Primary: lipgloss.Color("#1e66f5"),
		Accent:  lipgloss.Color("#ea76cb"),
		Success: lipgloss.Color("#40a02b"),
		Error:   lipgloss.Color("#d20f39"),
		Muted:   lipgloss.Color("#9ca0b0"),
		Normal:  lipgloss.Color("#4c4f69"),
		Info:    lipgloss.Color("#179299"),
	}
)

Preset themes - Light variants

View Source
var (
	// HighlightStyle for highlighting matched characters (pink, bold, underline)
	HighlightStyle = lipgloss.NewStyle().
		Foreground(Accent).
		Bold(true).
		Underline(true)
)

Text highlighting styles

View Source
var (
	// RoundedBorder creates a rounded border with primary color
	RoundedBorder = lipgloss.NewStyle().
		Border(lipgloss.RoundedBorder()).
		BorderForeground(Primary).
		Padding(1, 2)
)

Border styles

Functions

func FormatPRRef added in v0.15.0

func FormatPRRef(number int, state string, isDraft bool, url string) string

FormatPRRef returns a colored #<number> string with an OSC 8 hyperlink. Returns empty string if number == 0.

func FormatPRState

func FormatPRState(state string, isDraft bool) string

FormatPRState returns a formatted string with symbol and state. state should be forge.PRStateMerged, forge.PRStateOpen, forge.PRStateClosed, or empty. isDraft indicates if the PR is a draft (only applies to OPEN state).

func Init

func Init(cfg config.ThemeConfig)

Init initializes the theme from config Call this after loading config and before displaying any UI

func NerdfontEnabled

func NerdfontEnabled() bool

NerdfontEnabled returns whether nerd font symbols are enabled

func PRClosedSymbol

func PRClosedSymbol() string

PRClosedSymbol returns the symbol for closed PRs

func PRDraftSymbol

func PRDraftSymbol() string

PRDraftSymbol returns the symbol for draft PRs

func PRMergedSymbol

func PRMergedSymbol() string

PRMergedSymbol returns the symbol for merged PRs

func PROpenSymbol

func PROpenSymbol() string

PROpenSymbol returns the symbol for open PRs

func PRStateSymbol

func PRStateSymbol(state string, isDraft bool) string

PRStateSymbol returns just the symbol for a PR state

func PresetNames

func PresetNames() []string

PresetNames returns a list of available preset names (theme families)

func SetNerdfont

func SetNerdfont(enabled bool)

SetNerdfont enables or disables nerd font symbols

Types

type Symbols

type Symbols struct {
	PRMerged string
	PROpen   string
	PRClosed string
	PRDraft  string
}

Symbols holds the icon/symbol set based on nerdfont configuration

func CurrentSymbols

func CurrentSymbols() Symbols

CurrentSymbols returns the current symbol set

type Theme

type Theme struct {
	Primary color.Color // main accent color (borders, titles)
	Accent  color.Color // highlight color (selected items)
	Success color.Color // success indicators (checkmarks)
	Error   color.Color // error messages
	Muted   color.Color // disabled/inactive text
	Normal  color.Color // standard text
	Info    color.Color // informational text
}

Theme defines the color palette for UI components

func Current

func Current() Theme

Current returns the current theme

func GetPreset

func GetPreset(name string) *Theme

GetPreset returns a theme preset by name, or nil if not found For theme families with variants, returns the dark variant by default

Jump to

Keyboard shortcuts

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