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 ¶
- Variables
- func FormatPRRef(number int, state string, isDraft bool, url string) string
- func FormatPRState(state string, isDraft bool) string
- func Init(cfg config.ThemeConfig)
- func NerdfontEnabled() bool
- func PRClosedSymbol() string
- func PRDraftSymbol() string
- func PRMergedSymbol() string
- func PROpenSymbol() string
- func PRStateSymbol(state string, isDraft bool) string
- func PresetNames() []string
- func SetNerdfont(enabled bool)
- type Symbols
- type Theme
Constants ¶
This section is empty.
Variables ¶
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
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
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
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
var ( // HighlightStyle for highlighting matched characters (pink, bold, underline) HighlightStyle = lipgloss.NewStyle(). Foreground(Accent). Bold(true). Underline(true) )
Text highlighting styles
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
FormatPRRef returns a colored #<number> string with an OSC 8 hyperlink. Returns empty string if number == 0.
func FormatPRState ¶
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 PRStateSymbol ¶
PRStateSymbol returns just the symbol for a PR state
func PresetNames ¶
func PresetNames() []string
PresetNames returns a list of available preset names (theme families)
Types ¶
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