Documentation
¶
Overview ¶
Package styles define styling and theming for the project.
Index ¶
- Constants
- func ApplyBoldForegroundGrad(base lipgloss.Style, input string, color1, color2 color.Color) string
- func ApplyForegroundGrad(base lipgloss.Style, input string, color1, color2 color.Color) string
- func BuiltinThemeNames() []string
- func ColorString(s string) string
- func DeleteThemeFile(name string) error
- func FindThemeFile(name string) (string, error)
- func ForegroundGrad(base lipgloss.Style, input string, bold bool, color1, color2 color.Color) []string
- func IsBuiltinTheme(name string) bool
- func IsValidColor(s string) bool
- func ListUserThemes() ([]string, error)
- func ParseColor(s string) string
- func RenameThemeFile(oldName, newName string) (string, string, error)
- func SaveThemeFile(path string, tf *ThemeFile) error
- func ThemeDirs() []string
- func ThemeKeyForProvider(providerID string) string
- func ThemePath(name string) (string, error)
- func ValidateThemeName(name string) error
- func ValidateThemeRename(oldName, newName string) error
- type AttachmentStyles
- type Palette
- type PaletteField
- type Styles
- type ThemeFile
- type ThemeInfo
- type ThemeSource
Constants ¶
const ( CheckIcon string = "✓" SpinnerIcon string = "⋯" LoadingIcon string = "⟳" ModelIcon string = "◇" HypercreditIcon string = "◆" ArrowRightIcon string = "→" // CodespanPadding is the padding rendered around inline code spans in // markdown. It displays identically to the blank padding it replaced, // but selection copies recognize it and turn it back into the original // backticks (see list.HighlightContent). // // It is a no-break space tagged with the text-presentation variation // selector (U+FE0E): the pair is a single one-cell grapheme that // renders as a blank and, being non-breaking, keeps word wrap from // tearing a codespan between its padding and its text. The selector // makes the sentinel distinct from a real no-break space in message // text (pasted text, some LLM output), which a selection copy must // preserve verbatim. // // The selector must be U+FE0E, not the emoji-presentation U+FE0F: // ansi.StringWidth measures any cluster ending in U+FE0F as two // cells wide, while terminals render it as one, and that mismatch // makes the frame differ repaint the line on every frame (visible // as flicker). CodespanPadding string = "\u00a0\ufe0e" ToolPending string = "●" ToolSuccess string = "✓" ToolError string = "×" RadioOn string = "◉" RadioOff string = "○" BorderThin string = "│" BorderThick string = "▌" SectionSeparator string = "─" TodoCompletedIcon string = "✓" TodoPendingIcon string = "•" TodoInProgressIcon string = "→" ImageIcon string = "■" TextIcon string = "≡" SkillIcon string = "▲" RemoveIcon string = "✕" ColorSwatchIcon string = "■" ScrollbarThumb string = "┃" ScrollbarTrack string = "│" LSPErrorIcon string = "E" LSPWarningIcon string = "W" LSPInfoIcon string = "I" LSPHintIcon string = "H" )
const ThemeNameFormatHint = "use lowercase letters, numbers, hyphens, and underscores only"
ThemeNameFormatHint is the longest message the theme-name validators can return. Dialogs reserve space for it so they do not grow when an error appears.
Variables ¶
This section is empty.
Functions ¶
func ApplyBoldForegroundGrad ¶
ApplyBoldForegroundGrad renders a given string with a horizontal gradient foreground.
func ApplyForegroundGrad ¶
ApplyForegroundGrad renders a given string with a horizontal gradient foreground.
func BuiltinThemeNames ¶
func BuiltinThemeNames() []string
BuiltinThemeNames returns the names of all built-in themes, sorted.
func ColorString ¶
ColorString returns a lipgloss-compatible color string for the given input. Charmtone names are converted to hex; hex and ANSI values are returned as-is. Returns empty string for unrecognized input.
func DeleteThemeFile ¶
DeleteThemeFile removes a user theme file from disk. It rejects built-in themes and returns an error when the theme is not found.
func FindThemeFile ¶
FindThemeFile locates a global theme file by name. Returns an error for an invalid name or when no matching file exists.
func ForegroundGrad ¶
func ForegroundGrad(base lipgloss.Style, input string, bold bool, color1, color2 color.Color) []string
ForegroundGrad returns a slice of strings representing the input string rendered with a horizontal gradient foreground from color1 to color2. Each string in the returned slice corresponds to a grapheme cluster in the input string. If bold is true, the rendered strings will be bolded.
func IsBuiltinTheme ¶
IsBuiltinTheme reports whether the given name matches a built-in theme. Deprecated names still count as built-in.
func IsValidColor ¶
IsValidColor reports whether s is a valid color value: a hex code (#rgb, #rrggbb, #rgba, #rrggbbaa), an ANSI index (0-255), or a named charmtone color (case-insensitive).
func ListUserThemes ¶
ListUserThemes returns the names of all user-defined themes found across all theme directories. Names are lowercased and deduplicated; earlier directories take priority.
func ParseColor ¶
ParseColor normalizes a supported color for storage and display. It accepts hex codes, ANSI indices (0-255), and named Charmtone colors. Colors matching a Charmtone entry use its canonical name; other valid values are returned unchanged. Unrecognized input returns an empty string.
func RenameThemeFile ¶
RenameThemeFile renames a user theme file on disk. It locates the existing file via FindThemeFile, validates the new name, and moves the file in the same directory. Returns an error if the source file is not found, the new name is invalid, or a theme with the new name already exists.
func SaveThemeFile ¶
SaveThemeFile writes a theme file to disk with indented JSON. Parent directories are created automatically.
func ThemeDirs ¶
func ThemeDirs() []string
ThemeDirs returns the user theme directory. Theme files are global so launching Crush from different working directories always resolves the same themes. Themes live in the Crush config directory (the one holding the global config file) under themes/, which honors CRUSH_GLOBAL_CONFIG and matches the README on every platform.
func ThemeKeyForProvider ¶
ThemeKeyForProvider returns a stable identifier for the theme associated with the given provider ID. Providers that share a theme yield the same key, so callers can cheaply detect when switching providers would not actually change the active theme and skip the expensive style rebuild. This is the single source of truth for the provider-to-theme mapping; ThemeForProvider builds on it.
func ValidateThemeName ¶
ValidateThemeName reports whether name is usable as a theme file name. It rejects empty names, names with characters that are unsafe in file paths, and names that collide with an existing theme.
func ValidateThemeRename ¶
ValidateThemeRename is like ValidateThemeName but allows renaming a theme to itself (case-insensitive). It still rejects builtins and collisions with other themes.
Types ¶
type AttachmentStyles ¶
type AttachmentStyles struct {
Normal lipgloss.Style
Image lipgloss.Style
Text lipgloss.Style
Skill lipgloss.Style
Remove lipgloss.Style
Deleting lipgloss.Style
More lipgloss.Style // "N more…" hint for chips that didn't fit
}
AttachmentStyles are the styles for one attachment chip row. They are passed to the attachments renderer as a unit so adding a style does not mean touching every construction site.
type Palette ¶
type Palette struct {
Primary string `json:"primary,omitempty"`
Secondary string `json:"secondary,omitempty"`
Accent string `json:"accent,omitempty"`
Keyword string `json:"keyword,omitempty"`
FgBase string `json:"fg_base,omitempty"`
FgSubtle string `json:"fg_subtle,omitempty"`
FgMoreSubtle string `json:"fg_more_subtle,omitempty"`
FgMostSubtle string `json:"fg_most_subtle,omitempty"`
BgBase string `json:"bg_base,omitempty"`
BgMostVisible string `json:"bg_most_visible,omitempty"`
BgLessVisible string `json:"bg_less_visible,omitempty"`
BgLeastVisible string `json:"bg_least_visible,omitempty"`
OnPrimary string `json:"on_primary,omitempty"`
Separator string `json:"separator,omitempty"`
Destructive string `json:"destructive,omitempty"`
Error string `json:"error,omitempty"`
Warning string `json:"warning,omitempty"`
WarningSubtle string `json:"warning_subtle,omitempty"`
Attention string `json:"attention,omitempty"`
Busy string `json:"busy,omitempty"`
Info string `json:"info,omitempty"`
InfoMoreSubtle string `json:"info_more_subtle,omitempty"`
InfoMostSubtle string `json:"info_most_subtle,omitempty"`
Success string `json:"success,omitempty"`
SuccessMoreSubtle string `json:"success_more_subtle,omitempty"`
SuccessMostSubtle string `json:"success_most_subtle,omitempty"`
DiffInsertFg string `json:"diff_insert_fg,omitempty"`
DiffInsertCodeBg string `json:"diff_insert_code_bg,omitempty"`
DiffInsertGutterBg string `json:"diff_insert_gutter_bg,omitempty"`
DiffDeleteFg string `json:"diff_delete_fg,omitempty"`
DiffDeleteCodeBg string `json:"diff_delete_code_bg,omitempty"`
DiffDeleteGutterBg string `json:"diff_delete_gutter_bg,omitempty"`
Yolo string `json:"yolo,omitempty"`
Plan string `json:"plan,omitempty"`
PlanMoreSubtle string `json:"plan_more_subtle,omitempty"`
Button string `json:"button,omitempty"`
ButtonSubtle string `json:"button_subtle,omitempty"`
ButtonInactive string `json:"button_inactive,omitempty"`
ButtonHovered string `json:"button_hovered,omitempty"`
AnsiBlack string `json:"ansi_black,omitempty"`
AnsiRed string `json:"ansi_red,omitempty"`
AnsiGreen string `json:"ansi_green,omitempty"`
AnsiYellow string `json:"ansi_yellow,omitempty"`
AnsiBlue string `json:"ansi_blue,omitempty"`
AnsiMagenta string `json:"ansi_magenta,omitempty"`
AnsiCyan string `json:"ansi_cyan,omitempty"`
AnsiWhite string `json:"ansi_white,omitempty"`
AnsiBrightBlack string `json:"ansi_bright_black,omitempty"`
AnsiBrightRed string `json:"ansi_bright_red,omitempty"`
AnsiBrightGreen string `json:"ansi_bright_green,omitempty"`
AnsiBrightYellow string `json:"ansi_bright_yellow,omitempty"`
AnsiBrightBlue string `json:"ansi_bright_blue,omitempty"`
AnsiBrightMagenta string `json:"ansi_bright_magenta,omitempty"`
AnsiBrightCyan string `json:"ansi_bright_cyan,omitempty"`
AnsiBrightWhite string `json:"ansi_bright_white,omitempty"`
}
Palette is a JSON-serializable theme palette. Each field maps to a quickStyleOpts color, stored as a hex string ("#rrggbb"). Empty strings mean "inherit from base" when merging.
func MergePalette ¶
MergePalette applies palette overrides on top of a built-in base theme and returns the fully resolved palette. Empty baseName uses Charmtone. MergePalette applies palette overrides on top of a built-in or user theme and returns the fully resolved palette. Empty baseName uses Charmtone.
func PaletteFromOpts ¶
func PaletteFromOpts(o quickStyleOpts) Palette
PaletteFromOpts extracts a Palette from quickStyleOpts, converting each color.Color to its "#rrggbb" hex representation. Diff tokens left unset stay empty so overrides can flow through the merge chain; derivation happens once, after all overrides are applied (see deriveDiffColors).
func ThemePalette ¶
ThemePalette returns the Palette for a built-in theme by name. Returns an error if the theme is not recognized.
func (Palette) IsEmpty ¶
IsEmpty reports whether no palette colors are set, meaning the theme inherits everything from its base.
func (Palette) ToQuickStyleOpts ¶
func (p Palette) ToQuickStyleOpts(base quickStyleOpts) quickStyleOpts
ToQuickStyleOpts converts a Palette back to quickStyleOpts. Non-empty fields are parsed as hex colors; empty fields fall back to the provided base palette.
type PaletteField ¶
PaletteField describes a single customizable color token in a Palette. It pairs the JSON field name with getter/setter accessors so that validation, serialization checks, and UI editors can all iterate over the same ordered list without duplicating field names.
func PaletteFields ¶
func PaletteFields() []PaletteField
PaletteFields returns the ordered list of all customizable color tokens in a Palette. This is the single source of truth for field names, ordering, and access; Validate, knownThemeFields, and the theme editor all derive from it.
type Styles ¶
type Styles struct {
// ANSI holds the 16 standard ANSI colors (0-7 normal, 8-15 bright)
// used to remap legible colors onto raw terminal output, such as the
// output of bang-mode shell commands. Terminal programs emit the
// basic 16-color SGR codes (red, green, blue, …) and leave the actual
// colors up to the terminal; without this palette they fall through
// to the user's terminal defaults, which are often illegible on
// Sparkles's background. Defining them here keeps output readable and
// on-brand regardless of terminal configuration.
ANSI [16]color.Color
// Header
Header struct {
Charm lipgloss.Style // Style for "Charm™" label
Diagonals lipgloss.Style // Style for diagonal separators (╱)
Percentage lipgloss.Style // Style for context percentage
HypercreditIcon lipgloss.Style // Style for Hypercredit count (◆ N)
Keystroke lipgloss.Style // Style for keystroke hints (e.g., "ctrl+d")
KeystrokeTip lipgloss.Style // Style for keystroke action text (e.g., "open", "close")
WorkingDir lipgloss.Style // Style for current working directory
GitBranch lipgloss.Style // Style for the current git branch name
Separator lipgloss.Style // Style for separator dots (•)
Wrapper lipgloss.Style // Outer container for the entire header row
LogoGradCanvas lipgloss.Style // Canvas for the compact "Sparkles" gradient
LogoGradFromColor color.Color // "Sparkles" wordmark gradient start
LogoGradToColor color.Color // "Sparkles" wordmark gradient end
}
CompactDetails struct {
View lipgloss.Style
Version lipgloss.Style
Title lipgloss.Style
}
// Tool calls
ToolCallSuccess lipgloss.Style
// Text selection
TextSelection lipgloss.Style
// Markdown & Chroma
Markdown ansi.StyleConfig
QuietMarkdown ansi.StyleConfig
PlanMarkdown ansi.StyleConfig
// Inputs
TextInput textinput.Styles
// Help
Help help.Styles
// Diff
Diff diffview.Style
// FilePicker
FilePicker filepicker.Styles
// Buttons
Button struct {
Focused lipgloss.Style
Blurred lipgloss.Style
// Inactive styles buttons of a prompt that is not in the
// active pane: slightly lighter than Blurred so the choices
// stay legible while the chat has focus.
Inactive lipgloss.Style
Hovered lipgloss.Style
Negative lipgloss.Style // Selected negative/destructive action.
}
// Editor
Editor struct {
Textarea textarea.Styles
// Normal mode prompt ("> " icon on the first line, "::: " after).
PromptNormalIconFocused lipgloss.Style
PromptNormalIconBlurred lipgloss.Style
PromptNormalFocused lipgloss.Style
PromptNormalBlurred lipgloss.Style
// Plan mode prompt.
PromptPlanIconFocused lipgloss.Style
PromptPlanIconBlurred lipgloss.Style
PromptPlanDotsFocused lipgloss.Style
PromptPlanDotsBlurred lipgloss.Style
// YOLO mode prompt.
PromptYoloIconFocused lipgloss.Style
PromptYoloIconBlurred lipgloss.Style
PromptYoloDotsFocused lipgloss.Style
PromptYoloDotsBlurred lipgloss.Style
// Bang mode prompt (" ! " icon + ":::" dots, Turtle color).
PromptBangIconFocused lipgloss.Style
PromptBangIconBlurred lipgloss.Style
PromptBangDotsFocused lipgloss.Style
PromptBangDotsBlurred lipgloss.Style
// Question mode prompt (" ? " icon + ":::" dots).
PromptQuestionIconFocused lipgloss.Style
PromptQuestionIconBlurred lipgloss.Style
// Question choice styling.
QuestionSelected lipgloss.Style // Active choice text (Dolly).
QuestionUnselected lipgloss.Style // Inactive header text (Sash).
QuestionBody lipgloss.Style // Description/body text.
QuestionConfirm lipgloss.Style // Confirm tab title (primary).
QuestionNote lipgloss.Style // Saved note text (dimmer than body).
QuestionCursorBar lipgloss.Style // Active cursor indicator bar.
QuestionRadioOn lipgloss.Style // Selected single-choice radio.
QuestionRadioOff lipgloss.Style // Unselected single-choice radio.
QuestionCheckOn lipgloss.Style // Checked multi-choice indicator.
QuestionCheckOff lipgloss.Style // Unchecked multi-choice indicator.
}
// Radio
Radio struct {
On lipgloss.Style
Off lipgloss.Style
Label lipgloss.Style // Text next to a radio button
}
// Tabs for batch question forms. Uses uv types for direct
// screen rendering without lipgloss.
Tab struct {
ActiveBorder uv.Border
InactiveBorder uv.Border
ActiveBorderBlurred uv.Border
InactiveBorderBlurred uv.Border
ActiveStyle uv.Style
InactiveStyle uv.Style
}
// Background
Background color.Color
// Logo
Logo struct {
FieldColor color.Color
TitleColorA color.Color
TitleColorB color.Color
CharmColor color.Color
VersionColor color.Color
SmallCharm lipgloss.Style // "Charm™" label in SmallRender
SmallDiagonals lipgloss.Style // Diagonal line fill in SmallRender
GradCanvas lipgloss.Style // Blank canvas for gradient painting
SmallGradFromColor color.Color // Small "Crush" wordmark gradient start
SmallGradToColor color.Color // Small "Crush" wordmark gradient end
}
// Working indicator gradient (spinners/shimmers on assistant "thinking",
// tool-call pending, CLI generating, startup).
WorkingGradFromColor color.Color
WorkingGradToColor color.Color
WorkingLabelColor color.Color // Label text color next to the indicator
WorkingTimerColor color.Color // Elapsed timer suffix color
// Section Title
Section struct {
Title lipgloss.Style
Line lipgloss.Style
}
// Initialize
Initialize struct {
Header lipgloss.Style
Content lipgloss.Style
Accent lipgloss.Style
}
// LSP
LSP struct {
ErrorDiagnostic lipgloss.Style
WarningDiagnostic lipgloss.Style
HintDiagnostic lipgloss.Style
InfoDiagnostic lipgloss.Style
}
// Sidebar
Sidebar struct {
SessionTitle lipgloss.Style // Current session title at top of sidebar
WorkingDir lipgloss.Style // Working directory path (PrettyPath)
}
// ModelInfo (model name, provider, reasoning, token/cost summary)
ModelInfo struct {
Icon lipgloss.Style // Model icon (◇)
Name lipgloss.Style // Model name text
Provider lipgloss.Style // "via <provider>" text
ProviderFallback lipgloss.Style // Provider on its own second line
Reasoning lipgloss.Style // Reasoning effort text
TokenCount lipgloss.Style // "(42K)" token count
TokenPercentage lipgloss.Style // "42%" percent of context window
EstimatedUsagePrefix lipgloss.Style // "~" prefix for estimated usage
Cost lipgloss.Style // "$0.42" cost readout
HypercreditIcon lipgloss.Style // Hypercredit icon (◆)
HypercreditText lipgloss.Style // Remaining Hypercredits text
}
// Resource styles the LSP/MCP/skills sidebar lists: their heading,
// each row's status icon, name, status text, and truncation hints.
Resource struct {
Heading lipgloss.Style // Section header ("LSPs", "MCPs", "Skills")
Name lipgloss.Style // Resource name (e.g. "gopls")
StatusText lipgloss.Style // Row status description (e.g. "starting...")
OfflineIcon lipgloss.Style // Offline/unstarted/stopped status icon
DisabledIcon lipgloss.Style // Disabled status icon
BusyIcon lipgloss.Style // Busy/starting status icon
ErrorIcon lipgloss.Style // Error status icon
OnlineIcon lipgloss.Style // Online/ready status icon
OnlineText lipgloss.Style // Online/ready status text (e.g. "connected"), no icon
NeedsAuthIcon lipgloss.Style // Needs authentication status icon
AdditionalText lipgloss.Style // "None" and "…and N more" text
CapabilityCount lipgloss.Style // "N tools" / "N prompts" / "N resources"
RowTitleBase lipgloss.Style // Base style applied over row titles in common.Status
RowDescBase lipgloss.Style // Base style applied over row descriptions in common.Status
DefaultTitleFg color.Color // Default title color when opt is zero
DefaultDescFg color.Color // Default description color when opt is zero
}
// Files
Files struct {
Path lipgloss.Style
Additions lipgloss.Style
Deletions lipgloss.Style
SectionTitle lipgloss.Style // "Modified Files" heading
EmptyMessage lipgloss.Style // "None" placeholder when no files
TruncationHint lipgloss.Style // "…and N more" message
}
// Chat
// Messages - chat message item styles
Messages struct {
UserBlurred lipgloss.Style
UserFocused lipgloss.Style
AssistantBlurred lipgloss.Style
AssistantFocused lipgloss.Style
NoContent lipgloss.Style
Thinking lipgloss.Style
ErrorTag lipgloss.Style
ErrorTitle lipgloss.Style
ErrorDetails lipgloss.Style
ToolCallFocused lipgloss.Style
ToolCallCompact lipgloss.Style
ToolCallBlurred lipgloss.Style
// Shell (bang mode) item styles.
ShellBarFocused lipgloss.Style // Left vertical bar when focused.
ShellBarBlurred lipgloss.Style // Left vertical bar when blurred.
ShellPrompt lipgloss.Style // "$" prompt symbol (focused).
ShellPromptBlurred lipgloss.Style // "$" prompt symbol (blurred).
ShellCommand lipgloss.Style // Command text (syntax-highlighted).
ShellOutput lipgloss.Style // Plain output text.
ShellExitCode lipgloss.Style // Non-zero exit code indicator.
ShellTruncation lipgloss.Style // "N more lines" hint.
SectionHeader lipgloss.Style
// Plan section styles
PlanBox lipgloss.Style // Border+padding for the final plan message
// Thinking section styles
ThinkingBox lipgloss.Style // Background for thinking content
ThinkingTruncationHint lipgloss.Style // "… (N lines hidden)" hint
ThinkingFooterTitle lipgloss.Style // "Thought for" text
ThinkingFooterDuration lipgloss.Style // Duration value
AssistantInfoIcon lipgloss.Style
AssistantInfoModel lipgloss.Style
AssistantInfoProvider lipgloss.Style
AssistantInfoDuration lipgloss.Style
SubduedHypercreditIcon lipgloss.Style // Subdued ◆ for hypercredit figures within subdued text
AssistantCanceled lipgloss.Style // Italic "Canceled" footer
}
// Tool - styles for tool call rendering
Tool struct {
// Icon styles with tool status
IconPending lipgloss.Style
IconSuccess lipgloss.Style
IconError lipgloss.Style
IconCancelled lipgloss.Style
// Tool name styles
NameNormal lipgloss.Style // Top-level tool name
NameNested lipgloss.Style // Nested child tool name (inside Agent/Agentic Fetch)
// Parameter list styles
ParamMain lipgloss.Style
ParamKey lipgloss.Style
// Content rendering styles
ContentLine lipgloss.Style // Individual content line with background and width
ContentTruncation lipgloss.Style // Truncation message "… (N lines)"
ContentCodeLine lipgloss.Style // Code line with background and width
ContentCodeTruncation lipgloss.Style // Code truncation message with bgBase
ContentCodeBg color.Color // Background color for syntax highlighting
Body lipgloss.Style // Body content padding (PaddingLeft(2))
// Deprecated - kept for backward compatibility
ContentBg lipgloss.Style // Content background
ContentText lipgloss.Style // Content text
ContentLineNumber lipgloss.Style // Line numbers in code
// State message styles
StateWaiting lipgloss.Style // "Waiting for tool response..."
StateCancelled lipgloss.Style // "Canceled."
// Error styles
ErrorTag lipgloss.Style // ERROR tag
ErrorMessage lipgloss.Style // Error message text
// Warning styles (used for permission denied)
WarnTag lipgloss.Style // WARN tag
WarnMessage lipgloss.Style // Warning message text
// Diff styles
DiffTruncation lipgloss.Style // Diff truncation message with padding
// Multi-edit note styles
NoteTag lipgloss.Style // NOTE tag (yellow background)
NoteMessage lipgloss.Style // Note message text
// Job header styles (for bash jobs)
JobIconPending lipgloss.Style // Pending job icon (green dark)
JobIconError lipgloss.Style // Error job icon (red dark)
JobIconSuccess lipgloss.Style // Success job icon (green)
JobToolName lipgloss.Style // Job tool name "Bash" (blue)
JobAction lipgloss.Style // Action text (Start, Output, Kill)
JobPID lipgloss.Style // PID text
JobDescription lipgloss.Style // Description text
// Agent task styles
AgentTaskTag lipgloss.Style // Agent task tag (blue background, bold)
AgentPrompt lipgloss.Style // Agent prompt text
// Agentic fetch styles
AgenticFetchPromptTag lipgloss.Style // Agentic fetch prompt tag (green background, bold)
// Todo styles
TodoRatio lipgloss.Style // Todo ratio (e.g., "2/5")
TodoCompletedIcon lipgloss.Style // Completed todo icon
TodoInProgressIcon lipgloss.Style // In-progress todo icon
TodoPendingIcon lipgloss.Style // Pending todo icon
TodoStatusNote lipgloss.Style // " · completed N" / " · starting task" trailing note
TodoItem lipgloss.Style // Default body text for todo list items
TodoJustStarted lipgloss.Style // Text of the just-started todo in tool-call bodies
// MCP tools
MCPName lipgloss.Style // The mcp name
MCPToolName lipgloss.Style // The mcp tool name
MCPArrow lipgloss.Style // The mcp arrow icon
// Images and external resources
ResourceLoadedText lipgloss.Style
ResourceLoadedIndicator lipgloss.Style
ResourceName lipgloss.Style
ResourceSize lipgloss.Style
MediaType lipgloss.Style
// Hooks
HookLabel lipgloss.Style // "Hook" label
HookName lipgloss.Style // Hook command name
HookMatcher lipgloss.Style // Matcher regex pattern
HookArrow lipgloss.Style // Arrow indicator
HookDetail lipgloss.Style // Decision detail text
HookOK lipgloss.Style // "OK" status
HookDenied lipgloss.Style // "Denied" status
HookDeniedLabel lipgloss.Style // "Hook" label when denied
HookDeniedReason lipgloss.Style // Denied reason text
HookRewrote lipgloss.Style // "Rewrote Input" indicator
// Action verb colors for tool-call headers.
ActionCreate lipgloss.Style // Constructive actions (e.g. "Add", "Create")
ActionDestroy lipgloss.Style // Destructive actions (e.g. "Remove", "Delete")
// Tool result helpers.
ResultEmpty lipgloss.Style // "No results" placeholder
ResultTruncation lipgloss.Style // "… and N more" truncation line
ResultItemName lipgloss.Style // Item name (left column in result lists)
ResultItemDesc lipgloss.Style // Item description (right column)
}
// Dialog styles
Dialog struct {
Title lipgloss.Style
TitleText lipgloss.Style
TitleError lipgloss.Style
TitleAccent lipgloss.Style
TitleLineBase lipgloss.Style // Base for the gradient ╱╱╱ next to dialog titles
TitleGradFromColor color.Color // Default dialog title ╱╱╱ gradient start
TitleGradToColor color.Color // Default dialog title ╱╱╱ gradient end
// View is the main content area style.
View lipgloss.Style
PrimaryText lipgloss.Style
SecondaryText lipgloss.Style
// HelpView is the line that contains the help.
HelpView lipgloss.Style
Help struct {
Ellipsis lipgloss.Style
ShortKey lipgloss.Style
ShortDesc lipgloss.Style
ShortSeparator lipgloss.Style
FullKey lipgloss.Style
FullDesc lipgloss.Style
FullSeparator lipgloss.Style
}
NormalItem lipgloss.Style
SelectedItem lipgloss.Style
InputPrompt lipgloss.Style
List lipgloss.Style
Spinner lipgloss.Style
// ContentPanel is used for content blocks with subtle background.
ContentPanel lipgloss.Style
ContentPanelBg color.Color // Background color for ContentPanel syntax highlighting.
// Scrollbar styles for scrollable content.
ScrollbarThumb lipgloss.Style
ScrollbarTrack lipgloss.Style
// Arguments
Arguments struct {
Content lipgloss.Style
Description lipgloss.Style
InputLabelBlurred lipgloss.Style
InputLabelFocused lipgloss.Style
InputRequiredMarkBlurred lipgloss.Style
InputRequiredMarkFocused lipgloss.Style
}
// ListItem styles the info-text rendered alongside list items (commands,
// models, reasoning options). Sessions have their own overrides below.
ListItem struct {
InfoBlurred lipgloss.Style
InfoFocused lipgloss.Style
}
Models struct {
ConfiguredText lipgloss.Style // "Configured" badge shown on the ModelGroup header
}
Permissions struct {
KeyText lipgloss.Style // Left key cell of a key/value row
ValueText lipgloss.Style // Right value cell of a key/value row
ParamsBg color.Color // Background color behind highlighted JSON parameters
}
Quit struct {
Content lipgloss.Style // Wrapper for the quit dialog's inner content
Hint lipgloss.Style // Style for quit hint
Frame lipgloss.Style // Outer rounded border framing the quit dialog
}
APIKey struct {
Spinner lipgloss.Style // Loading spinner while validating the key
}
// AuthMethod styles the OAuth-vs-API-key choice dialog.
AuthMethod struct {
Prompt lipgloss.Style // "How would you like to authenticate?" question line
CardBlurred lipgloss.Style // Unselected choice card frame and label
CardFocused lipgloss.Style // Selected choice card frame and label
}
OAuth struct {
Spinner lipgloss.Style // Loading spinner
Instructions lipgloss.Style // Emphasized instruction text
UserCode lipgloss.Style // Prominent user code display
Success lipgloss.Style // Positive status text (e.g. "Authentication successful!")
Link lipgloss.Style // Underlined verification URL
Enter lipgloss.Style // "enter" keyword highlight in instructions
ErrorText lipgloss.Style // Error message when authentication fails
StatusText lipgloss.Style // Narrative status text ("Initializing...", "Verifying...", etc.)
UserCodeBg color.Color // Background color of the centered user-code box
}
ImagePreview lipgloss.Style
Sessions struct {
// styles for when we are in delete mode
DeletingView lipgloss.Style
DeletingItemFocused lipgloss.Style
DeletingItemBlurred lipgloss.Style
DeletingTitle lipgloss.Style
DeletingMessage lipgloss.Style
DeletingTitleGradientFromColor color.Color
DeletingTitleGradientToColor color.Color
// styles for when we are in update mode
RenamingView lipgloss.Style
RenamingingItemFocused lipgloss.Style
RenamingItemBlurred lipgloss.Style
RenamingingTitle lipgloss.Style
RenamingingMessage lipgloss.Style
RenamingTitleGradientFromColor color.Color
RenamingTitleGradientToColor color.Color
RenamingPlaceholder lipgloss.Style
InfoBlurred lipgloss.Style // Timestamp text on unfocused session items
InfoFocused lipgloss.Style // Timestamp text on the focused session item
}
}
// Status bar and help
Status struct {
Help lipgloss.Style
// Mode badges shown before the help hints.
ModeBadgePlan lipgloss.Style
ModeBadgeYolo lipgloss.Style
// Full-width banners shown when switching modes.
ModeBannerPlan lipgloss.Style
ModeBannerPlanBadge lipgloss.Style
ModeBannerYolo lipgloss.Style
ModeBannerYoloBadge lipgloss.Style
ErrorIndicator lipgloss.Style
WarnIndicator lipgloss.Style
InfoIndicator lipgloss.Style
UpdateIndicator lipgloss.Style
SuccessIndicator lipgloss.Style
ErrorMessage lipgloss.Style
WarnMessage lipgloss.Style
InfoMessage lipgloss.Style
UpdateMessage lipgloss.Style
SuccessMessage lipgloss.Style
}
// Completions popup styles
Completions struct {
Normal lipgloss.Style
Focused lipgloss.Style
Match lipgloss.Style
}
// Attachments styles
Attachments AttachmentStyles
// Pills styles for todo/queue pills
Pills struct {
Base lipgloss.Style // Base pill style with padding
Focused lipgloss.Style // Pill with visible rounded border
QueueItemPrefix lipgloss.Style // Prefix for queue list items
QueueItemText lipgloss.Style // Queue list item body text
QueueLabel lipgloss.Style // "N Queued" label text
QueueIconBase lipgloss.Style // Base style for queue gradient triangles
QueueGradFromColor color.Color // Start color for queue indicator gradient
QueueGradToColor color.Color // End color for queue indicator gradient
TodoLabel lipgloss.Style // "To-Do" label
TodoProgress lipgloss.Style // Todo ratio (e.g. "2/5")
TodoCurrentTask lipgloss.Style // Current in-progress task name
TodoSpinner lipgloss.Style // Todo spinner style
HelpKey lipgloss.Style // Keystroke hint style
HelpText lipgloss.Style // Help action text style
Area lipgloss.Style // Pills area container
}
}
func CharmtonePantera ¶
func CharmtonePantera() Styles
CharmtonePantera returns the Charmtone dark theme. It's the default style for the UI.
func HypercrushObsidiana ¶
func HypercrushObsidiana() Styles
HypercrushObsidiana returns the Hypercrush dark theme.
func LoadPaletteTheme ¶
LoadPaletteTheme builds Styles by applying palette overrides on top of a built-in base theme. Empty baseName uses the default Charmtone theme. LoadPaletteTheme builds Styles by applying palette overrides on top of a built-in or user theme. Empty baseName uses the default Charmtone theme.
func LoadTheme ¶
LoadTheme loads a theme by name. User theme files (in ThemeDirs) take precedence over built-in themes of the same name. Returns CharmtonePantera styles for an empty name. Returns an error if the name is not recognized as either a user file or a built-in. LoadTheme loads a theme by name. Global user theme files take precedence over built-in themes of the same name. Empty names use Charmtone.
func ThemeForProvider ¶
ThemeForProvider returns the Styles associated with the given provider ID. Unknown or empty provider IDs yield the default Charmtone Pantera theme.
func ThemeFromConfig ¶
ThemeFromConfig resolves the configured theme name, falling back to the default Charmtone theme when the config value is empty or invalid. The fallback is logged so a missing or broken theme file is not silently replaced by different colors.
func (*Styles) ChromaTheme ¶
func (s *Styles) ChromaTheme() chroma.StyleEntries
ChromaTheme converts the current markdown chroma styles to a chroma StyleEntries map.
func (*Styles) Clone ¶
Clone returns a deep copy of the Styles struct, ensuring pointer fields (particularly within ansi.StyleConfig) are not aliased. This is used to safely snapshot styles before a theme preview.
func (*Styles) DialogHelpStyles ¶
DialogHelpStyles returns the styles for dialog help.
type ThemeFile ¶
ThemeFile represents a standalone theme definition stored as JSON. It wraps a Palette with an optional base theme reference. Missing palette fields inherit from the base.
func ExportResolvedPalette ¶
ExportResolvedPalette resolves a theme fully (all palette tokens filled) and returns it as a ThemeFile suitable for writing to disk. This is used when forking a built-in theme or exporting the current palette. The returned ThemeFile has Base set to the source theme name and all Palette fields populated with resolved color values. ExportResolvedPalette resolves a theme fully and returns it as a ThemeFile suitable for writing to disk.
func LoadThemeFile ¶
LoadThemeFile reads and validates a theme file from disk. Unknown fields are logged as warnings but otherwise ignored. Returns an error if the file cannot be read or contains invalid color values.
type ThemeInfo ¶
type ThemeInfo struct {
Name string
Source ThemeSource
Overridden bool // true if a user file shadows a builtin
}
ThemeInfo describes an available theme for listing purposes.
func ListAllThemes ¶
func ListAllThemes() []ThemeInfo
ListAllThemes returns all available themes (built-in + global user files), sorted by name. Built-in themes shadowed by a user file are marked as Overridden.
type ThemeSource ¶
type ThemeSource int
ThemeSource indicates where a theme definition comes from.
const ( // ThemeSourceBuiltin is a theme compiled into the binary. ThemeSourceBuiltin ThemeSource = iota // ThemeSourceUser is a theme file in ~/.config/crush/themes/. ThemeSourceUser )
func (ThemeSource) String ¶
func (s ThemeSource) String() string
String returns a human-readable label for the theme source.