Documentation
¶
Index ¶
- func ActiveThemeName() string
- func AdaptiveColor(light, dark string) color.Color
- func ApplyGradient(text string, colorA, colorB color.Color) string
- func ApplyTheme(name string) error
- func ApplyThemeWithoutSave(name string) error
- func BaseStyle() lipgloss.Style
- func CreateBadge(text string, c color.Color) string
- func CreateProgressBar(width int, percentage float64, theme Theme) string
- func CreateSeparator(width int, char string, c color.Color) string
- func GetMarkdownTypography() *herald.Typography
- func IsDarkBackground() bool
- func KitBanner() string
- func ListThemes() []string
- func ProjectThemesDir() string
- func RefreshThemeRegistry()
- func RegisterThemeFromConfig(name string, ...)
- func SetTheme(theme Theme)
- func StyleCard(width int, theme Theme) lipgloss.Style
- func StyleError(theme Theme) lipgloss.Style
- func StyleHeader(theme Theme) lipgloss.Style
- func StyleInfo(theme Theme) lipgloss.Style
- func StyleMuted(theme Theme) lipgloss.Style
- func StyleSubheader(theme Theme) lipgloss.Style
- func StyleSuccess(theme Theme) lipgloss.Style
- func StyleWarning(theme Theme) lipgloss.Style
- func ToMarkdown(content string, width int) string
- func UserThemesDir() string
- type MarkdownThemeColors
- type Theme
- type ThemeEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActiveThemeName ¶
func ActiveThemeName() string
ActiveThemeName returns the name of the currently active theme by comparing against known entries. Returns "custom" if no match is found.
func AdaptiveColor ¶
AdaptiveColor picks between a light-mode and dark-mode hex color string based on the detected terminal background. This replaces the old lipgloss.AdaptiveColor{Light: ..., Dark: ...} pattern from v1.
func ApplyGradient ¶
ApplyGradient applies a color gradient from colorA to colorB across the text. Uses ~8 color stops for performance rather than per-character coloring.
func ApplyTheme ¶
ApplyTheme loads a theme by name and sets it as the active global theme. The selection is persisted to ~/.config/kit/preferences.yml so it survives across sessions. Persistence errors are silently ignored — the theme is still applied in-memory even if the write fails.
func ApplyThemeWithoutSave ¶
ApplyThemeWithoutSave loads a theme by name and sets it as the active global theme without persisting the choice. Used at startup to restore a previously saved preference without redundantly re-writing it.
func BaseStyle ¶
BaseStyle returns a new, empty lipgloss style that can be customized with additional styling methods. This serves as the foundation for building more complex styled components.
func CreateBadge ¶
CreateBadge generates a styled badge or label with inverted colors (text on colored background) for highlighting important tags, statuses, or categories.
func CreateProgressBar ¶
CreateProgressBar generates a visual progress bar with filled and empty segments based on the percentage complete. The bar uses Unicode block characters for smooth appearance and theme colors to indicate progress.
func CreateSeparator ¶
CreateSeparator generates a horizontal separator line with the specified width, character, and color. Useful for visually dividing sections of content in the UI.
func GetMarkdownTypography ¶
func GetMarkdownTypography() *herald.Typography
GetMarkdownTypography returns a herald.Typography configured with our active theme colors. The typography is cached and only rebuilt when the theme changes via SetTheme.
func IsDarkBackground ¶
func IsDarkBackground() bool
IsDarkBackground returns the cached terminal background detection result.
func KitBanner ¶
func KitBanner() string
KitBanner returns the KIT ASCII art title with KITT scanner lights, rendered with a KITT red gradient.
func ListThemes ¶
func ListThemes() []string
ListThemes returns the names of all available themes (built-in + user).
func ProjectThemesDir ¶
func ProjectThemesDir() string
projectThemesDir returns .kit/themes/ relative to the working directory. Returns "" if the directory doesn't exist (does NOT create it).
func RefreshThemeRegistry ¶
func RefreshThemeRegistry()
RefreshThemeRegistry re-scans the themes directory. Call after the user drops a new file into ~/.config/kit/themes/.
func RegisterThemeFromConfig ¶
func RegisterThemeFromConfig(name string, primary, secondary, success, warning, error_, info, text, muted, veryMuted, background, border, mutedBorder, system, tool, accent, highlight, mdHeading, mdLink, mdKeyword, mdString, mdNumber, mdComment [2]string)
RegisterThemeFromConfig adds a theme to the runtime registry from an extension's ThemeColorConfig (string hex pairs). Replaces any existing entry with the same name. The theme is immediately available via ListThemes, LoadThemeByName, and ApplyTheme.
func SetTheme ¶
func SetTheme(theme Theme)
SetTheme updates the global UI theme, affecting all subsequent rendering operations. This allows runtime theme switching for different visual preferences. It also invalidates the markdownTypographyCache so the next call to GetMarkdownTypography picks up the new theme.
func StyleCard ¶
StyleCard creates a lipgloss style for card-like containers with rounded borders, padding, and appropriate width. Used for grouping related content in a visually distinct box.
func StyleError ¶
StyleError creates a lipgloss style for error messages using red colors with bold text to ensure visibility of problems or failures.
func StyleHeader ¶
StyleHeader creates a lipgloss style for primary headers using the theme's primary color with bold text for emphasis and hierarchy.
func StyleInfo ¶
StyleInfo creates a lipgloss style for informational messages using blue colors with bold text for general notifications and status updates.
func StyleMuted ¶
StyleMuted creates a lipgloss style for de-emphasized text using muted colors and italic formatting, suitable for supplementary or less important information.
func StyleSubheader ¶
StyleSubheader creates a lipgloss style for secondary headers using the theme's secondary color with bold text, providing visual hierarchy below primary headers.
func StyleSuccess ¶
StyleSuccess creates a lipgloss style for success messages using green colors with bold text to indicate successful operations or positive outcomes.
func StyleWarning ¶
StyleWarning creates a lipgloss style for warning messages using yellow/amber colors with bold text to draw attention to potential issues or cautions.
func ToMarkdown ¶
ToMarkdown renders markdown content using herald-md. The width parameter is currently unused as herald handles wrapping based on terminal width internally.
func UserThemesDir ¶
func UserThemesDir() string
userThemesDir returns ~/.config/kit/themes, creating it if needed.
Types ¶
type MarkdownThemeColors ¶
type MarkdownThemeColors struct {
Text color.Color
Muted color.Color
Heading color.Color
Emph color.Color
Strong color.Color
Link color.Color
Code color.Color
Error color.Color
Keyword color.Color
String color.Color
Number color.Color
Comment color.Color
}
MarkdownThemeColors defines colors for markdown rendering and syntax highlighting.
type Theme ¶
type Theme struct {
Primary color.Color
Secondary color.Color
Success color.Color
Warning color.Color
Error color.Color
Info color.Color
Text color.Color
Muted color.Color
VeryMuted color.Color
Background color.Color
Border color.Color
MutedBorder color.Color
System color.Color
Tool color.Color
Accent color.Color
Highlight color.Color
// Diff block backgrounds
DiffInsertBg color.Color // Green-tinted bg for added lines
DiffDeleteBg color.Color // Red-tinted bg for removed lines
DiffEqualBg color.Color // Neutral bg for context lines
DiffMissingBg color.Color // Empty-cell bg when sides are uneven
// Code/output block backgrounds
CodeBg color.Color // Background for code blocks (Read tool)
GutterBg color.Color // Line-number gutter background
WriteBg color.Color // Green-tinted bg for Write tool content
// Markdown rendering and syntax highlighting colors
Markdown MarkdownThemeColors
}
Theme defines a comprehensive color scheme for the application's UI, supporting both light and dark terminal modes through adaptive colors. Inspired by the Knight Rider KITT aesthetic — scanner reds, amber dashboard glows, and dark cockpit tones.
func DefaultTheme ¶
func DefaultTheme() Theme
DefaultTheme creates and returns the default KIT theme inspired by the Knight Rider KITT aesthetic — scanner reds, amber dashboard glows, and a dark cockpit. No blues or bright greens; everything stays in the warm red/amber/gray family of KITT's instrument panel.
func GetTheme ¶
func GetTheme() Theme
GetTheme returns the currently active UI theme. The theme controls all color and styling decisions throughout the application's interface.
func LoadThemeByName ¶
LoadThemeByName looks up a theme by name, loads it if needed, and returns it.
type ThemeEntry ¶
type ThemeEntry struct {
Name string // Display name (filename stem or preset name)
Source string // "builtin" or absolute file path
// contains filtered or unexported fields
}
ThemeEntry is a named, loadable theme — either built-in or discovered from disk.
func (*ThemeEntry) Theme ¶
func (e *ThemeEntry) Theme() (Theme, error)
Theme returns the resolved ui.Theme, loading from disk on first access.