Documentation
¶
Overview ¶
Package styles — icons.go defines Nerd Font icon constants and a fallback mechanism for terminals without a Nerd Font installed.
Package styles defines the lipgloss colour palette and reusable styles for the Copilot CLI Session Browser TUI.
scheme.go holds the ColorScheme (raw ANSI palette) and Theme (derived semantic styles) types plus color-blending helpers.
Package styles defines the lipgloss colour palette and reusable styles for the Copilot CLI Session Browser TUI.
The package exposes the same set of style variables as before, but they are now backed by a Theme instance. Call SetTheme() to swap the active palette; all exported style variables are updated atomically.
When no explicit SetTheme() call is made the package initialises with the legacy adaptive-color palette so existing code keeps working.
Index ¶
- Constants
- Variables
- func BuiltinSchemeNames() []string
- func IconBullet() string
- func IconCheck() string
- func IconClock() string
- func IconFilter() string
- func IconFolder() string
- func IconFolderOpen() string
- func IconGear() string
- func IconGitBranch() string
- func IconHidden() string
- func IconKeyboard() string
- func IconPointer() string
- func IconSearch() string
- func IconSession() string
- func IconSortDown() string
- func IconSortUp() string
- func IconTitle() string
- func NerdFontEnabled() bool
- func SetNerdFontEnabled(enabled bool)
- func SetTheme(t *Theme)
- type ColorScheme
- type Theme
Constants ¶
const ( // MinTermWidth is the minimum terminal width in columns required for // the TUI to render correctly. MinTermWidth = 60 // PreviewMinWidth is the minimum terminal width at which the preview // panel becomes visible. PreviewMinWidth = 80 // PreviewWidthRatio is the fraction of the total width allocated to // the preview panel when it is visible. PreviewWidthRatio = 0.38 // HeaderLines is the number of lines reserved for the header area // (title + badges + separator). HeaderLines = 3 // header + badges + separator FooterLines = 1 )
Variables ¶
var ( // ColorPrimary is the accent color used for highlights, links, and // interactive elements. Updated by SetTheme. ColorPrimary lipgloss.TerminalColor = lipgloss.AdaptiveColor{Light: "#5A56E0", Dark: "#7C6FF4"} // ColorText is the primary foreground color for body text. // Updated by SetTheme. ColorText lipgloss.TerminalColor = lipgloss.AdaptiveColor{Light: "#1A1A2E", Dark: "#E4E4E7"} // ColorDimmed is a muted foreground color for secondary or // de-emphasised text. Updated by SetTheme. ColorDimmed lipgloss.TerminalColor = lipgloss.AdaptiveColor{Light: "#71717A", Dark: "#71717A"} )
var ( // TitleStyle renders the main application title. TitleStyle lipgloss.Style // SubtitleStyle renders secondary header text. SubtitleStyle lipgloss.Style // HeaderStyle renders the header bar background. HeaderStyle lipgloss.Style // SelectedStyle renders the currently highlighted session or list item. SelectedStyle lipgloss.Style // NormalStyle renders unselected session rows. NormalStyle lipgloss.Style // DimmedStyle renders muted or secondary text. DimmedStyle lipgloss.Style // HiddenStyle renders sessions the user has marked as hidden. HiddenStyle lipgloss.Style // GroupHeaderStyle renders collapsible folder/group headers in tree view. GroupHeaderStyle lipgloss.Style // BadgeStyle renders inactive filter/status badges. BadgeStyle lipgloss.Style // ActiveBadgeStyle renders currently active filter badges. ActiveBadgeStyle lipgloss.Style // PreviewBorderStyle renders the preview panel border and padding. PreviewBorderStyle lipgloss.Style // PreviewTitleStyle renders the title inside the preview panel. PreviewTitleStyle lipgloss.Style // PreviewLabelStyle renders field labels in the preview panel. PreviewLabelStyle lipgloss.Style // PreviewValueStyle renders field values in the preview panel. PreviewValueStyle lipgloss.Style // OverlayStyle renders the outer frame of modal overlays. OverlayStyle lipgloss.Style // OverlayTitleStyle renders the title inside modal overlays. OverlayTitleStyle lipgloss.Style // StatusBarStyle renders the bottom status bar text. StatusBarStyle lipgloss.Style // SearchPromptStyle renders the search input prompt icon. SearchPromptStyle lipgloss.Style // ErrorStyle renders error messages. ErrorStyle lipgloss.Style // SuccessStyle renders success messages. SuccessStyle lipgloss.Style // DimStyle renders de-emphasised inline text. DimStyle lipgloss.Style // KeyStyle renders keyboard shortcut key labels. KeyStyle lipgloss.Style // SpinnerStyle renders the loading spinner. SpinnerStyle lipgloss.Style // SeparatorStyle renders horizontal separator lines. SeparatorStyle lipgloss.Style // ConfigLabelStyle renders field labels in the config panel. ConfigLabelStyle lipgloss.Style // ConfigValueStyle renders field values in the config panel. ConfigValueStyle lipgloss.Style // ConfigDimmedValue renders inactive field values in the config panel. ConfigDimmedValue lipgloss.Style // ChatUserBubbleStyle renders user message bubbles in the preview. ChatUserBubbleStyle lipgloss.Style // ChatAssistantBubbleStyle renders assistant message bubbles in the preview. ChatAssistantBubbleStyle lipgloss.Style // ChatUserLabelStyle renders the "You" label above user messages. ChatUserLabelStyle lipgloss.Style // ChatAssistantLabelStyle renders the "Copilot" label above assistant messages. ChatAssistantLabelStyle lipgloss.Style )
var BuiltinSchemes = map[string]ColorScheme{ "Dispatch Dark": DispatchDark, "Dispatch Light": DispatchLight, "Campbell": Campbell, "One Half Dark": OneHalfDark, "One Half Light": OneHalfLight, }
BuiltinSchemes maps scheme names (case-sensitive) to their definitions.
var Campbell = ColorScheme{
Name: "Campbell",
Foreground: "#CCCCCC",
Background: "#0C0C0C",
Black: "#0C0C0C",
Red: "#C50F1F",
Green: "#13A10E",
Yellow: "#C19C00",
Blue: "#0037DA",
Purple: "#881798",
Cyan: "#3A96DD",
White: "#CCCCCC",
BrightBlack: "#767676",
BrightRed: "#E74856",
BrightGreen: "#16C60C",
BrightYellow: "#F9F1A5",
BrightBlue: "#3B78FF",
BrightPurple: "#B4009E",
BrightCyan: "#61D6D6",
BrightWhite: "#F2F2F2",
}
Campbell is the default Windows Terminal color scheme.
var DefaultDarkScheme = DispatchDark
DefaultDarkScheme is the fallback dark scheme (original hardcoded palette).
var DefaultLightScheme = DispatchLight
DefaultLightScheme is the fallback light scheme (original hardcoded palette).
var DispatchDark = ColorScheme{
Name: "Dispatch Dark",
Foreground: "#E4E4E7",
Background: "#111111",
Black: "#0C0C0C",
Red: "#DC2626",
Green: "#16A34A",
Yellow: "#C19C00",
Blue: "#5A56E0",
Purple: "#6D28D9",
Cyan: "#3A96DD",
White: "#CCCCCC",
BrightBlack: "#71717A",
BrightRed: "#F87171",
BrightGreen: "#4ADE80",
BrightYellow: "#F9F1A5",
BrightBlue: "#7C6FF4",
BrightPurple: "#A78BFA",
BrightCyan: "#61D6D6",
BrightWhite: "#F2F2F2",
}
DispatchDark reproduces the original hardcoded dark palette from theme.go.
var DispatchLight = ColorScheme{
Name: "Dispatch Light",
Foreground: "#1A1A2E",
Background: "#FAFAFA",
Black: "#0C0C0C",
Red: "#DC2626",
Green: "#16A34A",
Yellow: "#C19C00",
Blue: "#5A56E0",
Purple: "#6D28D9",
Cyan: "#3A96DD",
White: "#CCCCCC",
BrightBlack: "#71717A",
BrightRed: "#F87171",
BrightGreen: "#4ADE80",
BrightYellow: "#F9F1A5",
BrightBlue: "#7C6FF4",
BrightPurple: "#A78BFA",
BrightCyan: "#61D6D6",
BrightWhite: "#F2F2F2",
}
DispatchLight reproduces the original hardcoded light palette from theme.go.
var OneHalfDark = ColorScheme{
Name: "One Half Dark",
Foreground: "#DCDFE4",
Background: "#282C34",
Black: "#282C34",
Red: "#E06C75",
Green: "#98C379",
Yellow: "#E5C07B",
Blue: "#61AFEF",
Purple: "#C678DD",
Cyan: "#56B6C2",
White: "#DCDFE4",
BrightBlack: "#5A6374",
BrightRed: "#E06C75",
BrightGreen: "#98C379",
BrightYellow: "#E5C07B",
BrightBlue: "#61AFEF",
BrightPurple: "#C678DD",
BrightCyan: "#56B6C2",
BrightWhite: "#DCDFE4",
}
OneHalfDark is the One Half Dark color scheme (popular WT preset).
var OneHalfLight = ColorScheme{
Name: "One Half Light",
Foreground: "#383A42",
Background: "#FAFAFA",
Black: "#383A42",
Red: "#E45649",
Green: "#50A14F",
Yellow: "#C18401",
Blue: "#0184BC",
Purple: "#A626A4",
Cyan: "#0997B3",
White: "#FAFAFA",
BrightBlack: "#4F525D",
BrightRed: "#DF6C75",
BrightGreen: "#98C379",
BrightYellow: "#E4C07A",
BrightBlue: "#61AFEF",
BrightPurple: "#C577DD",
BrightCyan: "#56B5C1",
BrightWhite: "#FFFFFF",
}
OneHalfLight is the One Half Light color scheme (popular WT preset).
Functions ¶
func BuiltinSchemeNames ¶
func BuiltinSchemeNames() []string
BuiltinSchemeNames returns the built-in scheme names in display order.
func IconFolder ¶
func IconFolder() string
IconFolder returns the collapsed-folder icon ("" or "▸").
func IconFolderOpen ¶
func IconFolderOpen() string
IconFolderOpen returns the expanded-folder icon ("" or "▾").
func IconGitBranch ¶
func IconGitBranch() string
IconGitBranch returns the git branch icon ("" or "").
func IconHidden ¶
func IconHidden() string
IconHidden returns the hidden/eye-slash icon ("" or "⊘").
func IconPointer ¶
func IconPointer() string
IconPointer returns the cursor/selection indicator ("" or "▸").
func IconSession ¶
func IconSession() string
IconSession returns the session/terminal icon ("" or "").
func IconSortDown ¶
func IconSortDown() string
IconSortDown returns the descending sort arrow ("" or "↓").
func NerdFontEnabled ¶
func NerdFontEnabled() bool
NerdFontEnabled returns true when Nerd Font icons should be rendered.
func SetNerdFontEnabled ¶
func SetNerdFontEnabled(enabled bool)
SetNerdFontEnabled updates the global Nerd Font availability flag.
Types ¶
type ColorScheme ¶
type ColorScheme struct {
Name string `json:"name"`
Foreground string `json:"foreground"`
Background string `json:"background"`
CursorColor string `json:"cursorColor,omitempty"`
SelectionBackground string `json:"selectionBackground,omitempty"`
// Standard 8 ANSI colors.
Black string `json:"black"`
Red string `json:"red"`
Green string `json:"green"`
Yellow string `json:"yellow"`
Blue string `json:"blue"`
Purple string `json:"purple"`
Cyan string `json:"cyan"`
White string `json:"white"`
// Bright variants.
BrightBlack string `json:"brightBlack"`
BrightRed string `json:"brightRed"`
BrightGreen string `json:"brightGreen"`
BrightYellow string `json:"brightYellow"`
BrightBlue string `json:"brightBlue"`
BrightPurple string `json:"brightPurple"`
BrightCyan string `json:"brightCyan"`
BrightWhite string `json:"brightWhite"`
}
ColorScheme mirrors the Windows Terminal color scheme JSON object. All color values must be #RRGGBB hex strings.
func (*ColorScheme) Palette ¶ added in v0.1.1
func (cs *ColorScheme) Palette() [16]string
Palette returns the 16 ANSI colors in index order: [0]=Black, [1]=Red, …, [7]=White, [8]=BrightBlack, …, [15]=BrightWhite.
func (*ColorScheme) Validate ¶
func (cs *ColorScheme) Validate() error
Validate checks that all required color fields are valid #RRGGBB values.
type Theme ¶
type Theme struct {
// Name of the source color scheme.
SchemeName string
// Semantic colors (hex strings).
Primary string
Text string
Background string
Dimmed string
Border string
Selected string
Error string
Success string
Badge string
BadgeBg string
StatusBg string
HeaderBg string
// Whether the scheme is dark-background.
IsDark bool
// ANSIPalette holds the 16 ANSI colors from the source scheme.
ANSIPalette [16]string
// Pre-computed styles — match the exported var names in theme.go.
TitleStyle lipgloss.Style
SubtitleStyle lipgloss.Style
HeaderStyle lipgloss.Style
SelectedStyle lipgloss.Style
NormalStyle lipgloss.Style
DimmedStyle lipgloss.Style
HiddenStyle lipgloss.Style
GroupHeaderStyle lipgloss.Style
BadgeStyle lipgloss.Style
ActiveBadgeStyle lipgloss.Style
PreviewBorder lipgloss.Style
PreviewTitle lipgloss.Style
PreviewLabel lipgloss.Style
PreviewValue lipgloss.Style
OverlayStyle lipgloss.Style
OverlayTitle lipgloss.Style
StatusBar lipgloss.Style
SearchPrompt lipgloss.Style
ErrorStyle lipgloss.Style
SuccessStyle lipgloss.Style
DimStyle lipgloss.Style
KeyStyle lipgloss.Style
SpinnerStyle lipgloss.Style
SeparatorStyle lipgloss.Style
ConfigLabel lipgloss.Style
ConfigValue lipgloss.Style
ConfigDimmedValue lipgloss.Style
// Chat message bubble styles.
ChatUserBubble lipgloss.Style
ChatAssistantBubble lipgloss.Style
ChatUserLabel lipgloss.Style
ChatAssistantLabel lipgloss.Style
}
Theme holds the resolved semantic colors derived from a ColorScheme and all pre-computed lipgloss styles used throughout the TUI.
func CurrentTheme ¶
func CurrentTheme() *Theme
CurrentTheme returns the active Theme (never nil after init).
func DeriveTheme ¶
func DeriveTheme(cs ColorScheme) *Theme
DeriveTheme produces a complete Theme from a raw ColorScheme. It computes semantic colors by blending palette entries and then builds every lipgloss.Style used in the TUI.