Documentation
¶
Overview ¶
Package styles provides shared lipgloss v2 styles for CLI and TUI components.
Index ¶
- Constants
- Variables
- func ColorForString(s string) color.Color
- func GlamourStyle() glamouransi.StyleConfig
- func PulseColor(base color.Color, frame, frames int, minBrightness float64) color.Color
- func RenderStatusIndicator(status terminal.Status) string
- func SetTheme(p Palette)
- func ThemeNames() []string
- type Palette
Constants ¶
const ( StatusIndicatorActive = "[●]" StatusIndicatorApproval = "[!]" StatusIndicatorReady = "[>]" StatusIndicatorMissing = "[?]" StatusIndicatorRecycled = "[○]" )
Status indicator constants for session display.
const DefaultTheme = "tokyo-night"
DefaultTheme is the name of the default theme.
Variables ¶
var ( IconGithub = "\uf09b " IconGitBranch = "\ue725" // IconGit = "\ue702" // IconCheckList = "\uf4a0 " // IconMail = "\ueb1c" // IconBee = "\U000F0FA1" // IconHive = "\U000F10CE" // IconBrain = " " IconComment = "\uf41f " IconTodo = "\uf4a0 " // checklist IconFolder = " " IconFolderOpen = " " IconFile = " " IconNotifyError = "\uf06a" // IconNotifyWarning = "\uf071" // IconNotifyInfo = "\uf05a" // IconSelector = "" IconTodoPending = " " IconTodoAcknowledged = IconTodoPending // From a user perspective, acknowledged is only different from pending in that a UI notification was shown IconTodoCompleted = " " IconTodoDismissed = " " )
var ( ColorPrimary color.Color ColorSecondary color.Color ColorForeground color.Color ColorMuted color.Color ColorBackground color.Color ColorSurface color.Color ColorSuccess color.Color ColorWarning color.Color ColorError color.Color )
Semantic color aliases set by SetTheme.
var ( // CLI styles. CommandHeaderStyle lipgloss.Style // TUI shared styles. ModalStyle lipgloss.Style ModalDangerStyle lipgloss.Style FormModalStyle lipgloss.Style ModalTitleStyle lipgloss.Style ModalDangerTitleStyle lipgloss.Style ModalHelpStyle lipgloss.Style ModalButtonStyle lipgloss.Style ModalButtonSelectedStyle lipgloss.Style ModalInputStyle lipgloss.Style ModalInputReadyStyle lipgloss.Style TextMutedStyle lipgloss.Style TextPrimaryStyle lipgloss.Style TextPrimaryBoldStyle lipgloss.Style TextSecondaryStyle lipgloss.Style TextForegroundStyle lipgloss.Style TextForegroundBoldStyle lipgloss.Style TextSuccessStyle lipgloss.Style TextWarningStyle lipgloss.Style TextErrorStyle lipgloss.Style TextSurfaceStyle lipgloss.Style ViewSelectedStyle lipgloss.Style ViewNormalStyle lipgloss.Style FormTitleStyle lipgloss.Style FormFieldStyle lipgloss.Style FormFieldFocusedStyle lipgloss.Style // Help dialog styles. HelpDialogSectionStyle lipgloss.Style // Confirm modal styles. ConfirmMessageStyle lipgloss.Style // Review comment modal styles. ReviewCommentTitleStyle lipgloss.Style ReviewCommentLabelStyle lipgloss.Style ReviewCommentContextStyle lipgloss.Style ReviewCommentHelpStyle lipgloss.Style // Review finalize modal styles. ReviewFinalizeOptionStyle lipgloss.Style ReviewFinalizeModalStyle lipgloss.Style // Review view styles. ReviewEmptyMessageStyle lipgloss.Style ReviewOverlayModalStyle lipgloss.Style ReviewSelectionStyle lipgloss.Style ReviewCursorStyle lipgloss.Style ReviewSearchMatchStyle lipgloss.Style ReviewCurrentSearchMatchStyle lipgloss.Style ReviewCommentedLineNumStyle lipgloss.Style ReviewSearchInputStyle lipgloss.Style ReviewModeNormalStyle lipgloss.Style ReviewModeVisualStyle lipgloss.Style ReviewModeSearchStyle lipgloss.Style ReviewPosStyle lipgloss.Style ReviewHelpStyle lipgloss.Style ReviewStatusBarBgStyle lipgloss.Style ReviewInlineCommentStyle lipgloss.Style ReviewTreeHeaderStyle lipgloss.Style ReviewTreeHeaderSelectedStyle lipgloss.Style // Messages view styles. MessagesHelpStyle lipgloss.Style MessagesPayloadSelectedStyle lipgloss.Style // Command palette styles. CommandPaletteHelpSelectedStyle lipgloss.Style CommandPaletteMoreStyle lipgloss.Style // Toast styles. ToastInfoStyle lipgloss.Style ToastWarningStyle lipgloss.Style ToastErrorStyle lipgloss.Style // Select field styles. SelectFieldItemSelectedStyle lipgloss.Style // Status bar style. StatusBarStyle lipgloss.Style // TUI layout styles. ListFilterPromptStyle lipgloss.Style ListHelpContainerStyle lipgloss.Style TabBrandingStyle lipgloss.Style TabUpdateBadgeStyle lipgloss.Style PreviewHeaderNameStyle lipgloss.Style PreviewTopicStyle lipgloss.Style PreviewSessionStyle lipgloss.Style )
Style exports.
var ColorPool []color.Color
ColorPool is used for deterministic color hashing of topics and senders.
Functions ¶
func ColorForString ¶
ColorForString returns a deterministic color for a given string. The same string always produces the same color.
func GlamourStyle ¶
func GlamourStyle() glamouransi.StyleConfig
GlamourStyle returns a Glamour style config derived from the active theme.
func PulseColor ¶ added in v0.36.0
PulseColor returns a color dimmed by a triangle-wave brightness cycle. frame is the current animation frame, frames is the total cycle length, and minBrightness (0.0–1.0) controls how dim the color gets at the midpoint.
func RenderStatusIndicator ¶ added in v0.41.0
RenderStatusIndicator returns a colored status indicator string for the given terminal status.
func SetTheme ¶
func SetTheme(p Palette)
SetTheme sets the active palette and rebuilds all global styles.
func ThemeNames ¶
func ThemeNames() []string
ThemeNames returns sorted names of all built-in themes.
Types ¶
type Palette ¶
type Palette struct {
Primary color.Color
Secondary color.Color
Foreground color.Color
Muted color.Color
Background color.Color
Surface color.Color
Success color.Color
Warning color.Color
Error color.Color
}
Palette defines a minimal semantic theme palette.
var CurrentPalette Palette
CurrentPalette holds the active theme palette.
func GetPalette ¶
GetPalette returns the palette for the given theme name.