Documentation
¶
Overview ¶
This file contains ConfigTheme — the sole concrete implementation of Theme used for all built-in and user-provided themes loaded from TOML files. It also holds the embed directive, lazy registry, and export helpers.
Package theme defines the Theme interface and the config-driven loader used to resolve a config theme ID to a concrete theme implementation.
Components call Theme methods to obtain colours — they never use raw hex strings. Themes are loaded from embedded TOML files (built-in) and from ~/.config/spotnik/themes/ (user overrides). The active theme is loaded once at startup and injected into every pane constructor.
Index ¶
- Constants
- func Available() []string
- func LoadAllWithUserDir(userDir string) (map[string]*ConfigTheme, error)
- type ConfigTheme
- func (t *ConfigTheme) Accent() lipgloss.Color
- func (t *ConfigTheme) ActiveBorder() lipgloss.Color
- func (t *ConfigTheme) Base() lipgloss.Color
- func (t *ConfigTheme) ColumnIndex() lipgloss.Color
- func (t *ConfigTheme) ColumnPrimary() lipgloss.Color
- func (t *ConfigTheme) ColumnSecondary() lipgloss.Color
- func (t *ConfigTheme) ColumnTertiary() lipgloss.Color
- func (t *ConfigTheme) Error() lipgloss.Color
- func (t *ConfigTheme) Gradient1() lipgloss.Color
- func (t *ConfigTheme) Gradient2() lipgloss.Color
- func (t *ConfigTheme) Gradient3() lipgloss.Color
- func (t *ConfigTheme) HeaderChipFg() lipgloss.Color
- func (t *ConfigTheme) ID() string
- func (t *ConfigTheme) InactiveBorder() lipgloss.Color
- func (t *ConfigTheme) Info() lipgloss.Color
- func (t *ConfigTheme) KeyHint() lipgloss.Color
- func (t *ConfigTheme) Name() string
- func (t *ConfigTheme) PaneBorderAlbums() lipgloss.Color
- func (t *ConfigTheme) PaneBorderLikedSongs() lipgloss.Color
- func (t *ConfigTheme) PaneBorderNetworkLog() lipgloss.Color
- func (t *ConfigTheme) PaneBorderNowPlaying() lipgloss.Color
- func (t *ConfigTheme) PaneBorderPlaylists() lipgloss.Color
- func (t *ConfigTheme) PaneBorderQueue() lipgloss.Color
- func (t *ConfigTheme) PaneBorderRecentlyPlayed() lipgloss.Color
- func (t *ConfigTheme) PaneBorderRequestFlow() lipgloss.Color
- func (t *ConfigTheme) PaneBorderTopArtists() lipgloss.Color
- func (t *ConfigTheme) PaneBorderTopTracks() lipgloss.Color
- func (t *ConfigTheme) PlayingIndicator() lipgloss.Color
- func (t *ConfigTheme) PresetIndicator() lipgloss.Color
- func (t *ConfigTheme) SectionHeader() lipgloss.Color
- func (t *ConfigTheme) SeekBar() lipgloss.Color
- func (t *ConfigTheme) SelectedBg() lipgloss.Color
- func (t *ConfigTheme) SelectedFg() lipgloss.Color
- func (t *ConfigTheme) StatusBarBg() lipgloss.Color
- func (t *ConfigTheme) StatusBarFg() lipgloss.Color
- func (t *ConfigTheme) Success() lipgloss.Color
- func (t *ConfigTheme) Surface() lipgloss.Color
- func (t *ConfigTheme) SurfaceAlt() lipgloss.Color
- func (t *ConfigTheme) TableHeader() lipgloss.Color
- func (t *ConfigTheme) TextMuted() lipgloss.Color
- func (t *ConfigTheme) TextPrimary() lipgloss.Color
- func (t *ConfigTheme) TextSecondary() lipgloss.Color
- func (t *ConfigTheme) VisualizerFg() lipgloss.Color
- func (t *ConfigTheme) VolumeBar() lipgloss.Color
- func (t *ConfigTheme) Warning() lipgloss.Color
- type Theme
Constants ¶
const DefaultThemeID = "black"
DefaultThemeID is the fallback theme ID used when an unknown ID is provided. It is always "black" and can never be empty.
Variables ¶
This section is empty.
Functions ¶
func Available ¶
func Available() []string
Available returns all registered theme IDs in sorted order. The list grows automatically as new TOML files are embedded or dropped into the user theme directory.
func LoadAllWithUserDir ¶
func LoadAllWithUserDir(userDir string) (map[string]*ConfigTheme, error)
LoadAllWithUserDir loads all built-in themes and then applies user themes from the given directory, with user themes overriding built-ins by ID. It is exported so tests can inject a custom user theme directory without touching the real filesystem.
Types ¶
type ConfigTheme ¶
type ConfigTheme struct {
// contains filtered or unexported fields
}
ConfigTheme implements Theme by loading color values from a parsed TOML file. This is the sole concrete implementation used for all themes (built-in and user-provided).
func AllThemes ¶
func AllThemes() []*ConfigTheme
AllThemes returns all loaded ConfigTheme instances, sorted by ID. Used by the theme switcher overlay to display names and preview colors.
func ParseTheme ¶
func ParseTheme(data []byte) (*ConfigTheme, error)
ParseTheme decodes TOML bytes into a ConfigTheme. Returns an error if the TOML is malformed, the id field is missing, or any color field is empty. This is exported so tests and tooling can parse TOML snippets directly.
func (*ConfigTheme) Accent ¶
func (t *ConfigTheme) Accent() lipgloss.Color
Accent returns the CLI accent color used by cliout palette resolution in "theme" mode. When the TOML "accent" field is absent or empty, it falls back to SeekBar().
func (*ConfigTheme) ActiveBorder ¶
func (t *ConfigTheme) ActiveBorder() lipgloss.Color
ActiveBorder returns the focused pane border color.
func (*ConfigTheme) Base ¶
func (t *ConfigTheme) Base() lipgloss.Color
Base returns the app canvas background color.
func (*ConfigTheme) ColumnIndex ¶
func (t *ConfigTheme) ColumnIndex() lipgloss.Color
ColumnIndex returns the # column foreground color (muted but colorful).
func (*ConfigTheme) ColumnPrimary ¶
func (t *ConfigTheme) ColumnPrimary() lipgloss.Color
ColumnPrimary returns the main data column color (track name, playlist name).
func (*ConfigTheme) ColumnSecondary ¶
func (t *ConfigTheme) ColumnSecondary() lipgloss.Color
ColumnSecondary returns the supporting column color (artist, genre).
func (*ConfigTheme) ColumnTertiary ¶
func (t *ConfigTheme) ColumnTertiary() lipgloss.Color
ColumnTertiary returns the metadata column color (duration, year, played time).
func (*ConfigTheme) Error ¶
func (t *ConfigTheme) Error() lipgloss.Color
Error returns the error message color.
func (*ConfigTheme) Gradient1 ¶
func (t *ConfigTheme) Gradient1() lipgloss.Color
Gradient1 returns the seek bar start / low volume color.
func (*ConfigTheme) Gradient2 ¶
func (t *ConfigTheme) Gradient2() lipgloss.Color
Gradient2 returns the seek bar end / mid volume color.
func (*ConfigTheme) Gradient3 ¶
func (t *ConfigTheme) Gradient3() lipgloss.Color
Gradient3 returns the high volume color.
func (*ConfigTheme) HeaderChipFg ¶
func (t *ConfigTheme) HeaderChipFg() lipgloss.Color
HeaderChipFg returns the foreground color for header chips (device chip, profile chip).
func (*ConfigTheme) ID ¶
func (t *ConfigTheme) ID() string
ID returns the config key for this theme (e.g. "black", "dracula").
func (*ConfigTheme) InactiveBorder ¶
func (t *ConfigTheme) InactiveBorder() lipgloss.Color
InactiveBorder returns the unfocused pane border color.
func (*ConfigTheme) Info ¶
func (t *ConfigTheme) Info() lipgloss.Color
Info returns the informational notice color (used for info toasts).
func (*ConfigTheme) KeyHint ¶
func (t *ConfigTheme) KeyHint() lipgloss.Color
KeyHint returns the keybinding label color.
func (*ConfigTheme) Name ¶
func (t *ConfigTheme) Name() string
Name returns the human-readable display name (e.g. "True Black", "Dracula").
func (*ConfigTheme) PaneBorderAlbums ¶
func (t *ConfigTheme) PaneBorderAlbums() lipgloss.Color
PaneBorderAlbums returns the albums pane border accent color.
func (*ConfigTheme) PaneBorderLikedSongs ¶
func (t *ConfigTheme) PaneBorderLikedSongs() lipgloss.Color
PaneBorderLikedSongs returns the liked songs pane border accent color.
func (*ConfigTheme) PaneBorderNetworkLog ¶
func (t *ConfigTheme) PaneBorderNetworkLog() lipgloss.Color
PaneBorderNetworkLog returns the network log pane border accent color.
func (*ConfigTheme) PaneBorderNowPlaying ¶
func (t *ConfigTheme) PaneBorderNowPlaying() lipgloss.Color
PaneBorderNowPlaying returns the now-playing pane border accent color.
func (*ConfigTheme) PaneBorderPlaylists ¶
func (t *ConfigTheme) PaneBorderPlaylists() lipgloss.Color
PaneBorderPlaylists returns the playlists pane border accent color.
func (*ConfigTheme) PaneBorderQueue ¶
func (t *ConfigTheme) PaneBorderQueue() lipgloss.Color
PaneBorderQueue returns the queue pane border accent color.
func (*ConfigTheme) PaneBorderRecentlyPlayed ¶
func (t *ConfigTheme) PaneBorderRecentlyPlayed() lipgloss.Color
PaneBorderRecentlyPlayed returns the recently played pane border accent color.
func (*ConfigTheme) PaneBorderRequestFlow ¶
func (t *ConfigTheme) PaneBorderRequestFlow() lipgloss.Color
PaneBorderRequestFlow returns the request flow pane border accent color.
func (*ConfigTheme) PaneBorderTopArtists ¶
func (t *ConfigTheme) PaneBorderTopArtists() lipgloss.Color
PaneBorderTopArtists returns the top artists pane border accent color.
func (*ConfigTheme) PaneBorderTopTracks ¶
func (t *ConfigTheme) PaneBorderTopTracks() lipgloss.Color
PaneBorderTopTracks returns the top tracks pane border accent color.
func (*ConfigTheme) PlayingIndicator ¶
func (t *ConfigTheme) PlayingIndicator() lipgloss.Color
PlayingIndicator returns the currently-playing indicator color.
func (*ConfigTheme) PresetIndicator ¶
func (t *ConfigTheme) PresetIndicator() lipgloss.Color
PresetIndicator returns the preset label color.
func (*ConfigTheme) SectionHeader ¶
func (t *ConfigTheme) SectionHeader() lipgloss.Color
SectionHeader returns the section label color.
func (*ConfigTheme) SeekBar ¶
func (t *ConfigTheme) SeekBar() lipgloss.Color
SeekBar returns the seek bar fill color.
func (*ConfigTheme) SelectedBg ¶
func (t *ConfigTheme) SelectedBg() lipgloss.Color
SelectedBg returns the selected list item background color.
func (*ConfigTheme) SelectedFg ¶
func (t *ConfigTheme) SelectedFg() lipgloss.Color
SelectedFg returns the selected list item foreground color.
func (*ConfigTheme) StatusBarBg ¶
func (t *ConfigTheme) StatusBarBg() lipgloss.Color
StatusBarBg returns the status bar background color.
func (*ConfigTheme) StatusBarFg ¶
func (t *ConfigTheme) StatusBarFg() lipgloss.Color
StatusBarFg returns the status bar body text color.
func (*ConfigTheme) Success ¶
func (t *ConfigTheme) Success() lipgloss.Color
Success returns the success state color.
func (*ConfigTheme) Surface ¶
func (t *ConfigTheme) Surface() lipgloss.Color
Surface returns the pane interior background color.
func (*ConfigTheme) SurfaceAlt ¶
func (t *ConfigTheme) SurfaceAlt() lipgloss.Color
SurfaceAlt returns the overlay background color.
func (*ConfigTheme) TableHeader ¶
func (t *ConfigTheme) TableHeader() lipgloss.Color
TableHeader returns the column header text color.
func (*ConfigTheme) TextMuted ¶
func (t *ConfigTheme) TextMuted() lipgloss.Color
TextMuted returns the dim text color for timestamps, counts, hints.
func (*ConfigTheme) TextPrimary ¶
func (t *ConfigTheme) TextPrimary() lipgloss.Color
TextPrimary returns the main content text color.
func (*ConfigTheme) TextSecondary ¶
func (t *ConfigTheme) TextSecondary() lipgloss.Color
TextSecondary returns the supporting text color.
func (*ConfigTheme) VisualizerFg ¶
func (t *ConfigTheme) VisualizerFg() lipgloss.Color
VisualizerFg returns the braille dot foreground color.
func (*ConfigTheme) VolumeBar ¶
func (t *ConfigTheme) VolumeBar() lipgloss.Color
VolumeBar returns the volume bar fill color.
func (*ConfigTheme) Warning ¶
func (t *ConfigTheme) Warning() lipgloss.Color
Warning returns the caution notice color.
type Theme ¶
type Theme interface {
// Backgrounds
Base() lipgloss.Color // App canvas background
Surface() lipgloss.Color // Pane interior background
SurfaceAlt() lipgloss.Color // Overlay backgrounds (search, devices, help)
// Borders
ActiveBorder() lipgloss.Color // Focused pane border
InactiveBorder() lipgloss.Color // Unfocused pane borders
// Text hierarchy
TextPrimary() lipgloss.Color // Main content — track names, body text
TextSecondary() lipgloss.Color // Supporting — artist names, subtitles
TextMuted() lipgloss.Color // Dim — timestamps, counts, hints
// Selection
SelectedBg() lipgloss.Color // Selected list item background (retained for backward compat)
// SelectedFg is the selection accent applied to item text (name + subtitle lines)
// when a list item is focused. Used WITHOUT a background fill — must be visually
// distinct from ColumnSecondary, ColumnTertiary, and TextPrimary in every theme.
SelectedFg() lipgloss.Color
// Semantic colours
SectionHeader() lipgloss.Color // Section labels: LIBRARY, QUEUE, NOW PLAYING
PlayingIndicator() lipgloss.Color // playing symbol (GlyphPlaying role)
SeekBar() lipgloss.Color // Seek bar fill
VolumeBar() lipgloss.Color // Volume bar fill
Success() lipgloss.Color // Success states
Warning() lipgloss.Color // Caution notices
Error() lipgloss.Color // Error messages
Info() lipgloss.Color // Informational notices (info toasts)
HeaderChipFg() lipgloss.Color // header chip foreground (device chip, profile chip)
// Status bar
StatusBarBg() lipgloss.Color // Status bar background
StatusBarFg() lipgloss.Color // Status bar body text
KeyHint() lipgloss.Color // Keybinding key labels (Space, Tab, etc.)
// Gradient bars — seek bar fill stages and volume bands (Feature 44)
Gradient1() lipgloss.Color // Seek bar start / low volume (cool)
Gradient2() lipgloss.Color // Seek bar end / mid volume
Gradient3() lipgloss.Color // High volume (hot)
// Visualizer — braille-dot audio spectrum (Feature 44)
VisualizerFg() lipgloss.Color // Braille dot foreground
// Tables — dense column header text (Feature 43+)
TableHeader() lipgloss.Color // Column header text
// Status — preset label in the header bar
PresetIndicator() lipgloss.Color // Preset label in header
// Per-pane borders — distinct accent colour per pane, btop-style identity (Feature 42)
PaneBorderNowPlaying() lipgloss.Color // Green accent
PaneBorderQueue() lipgloss.Color // Yellow accent
PaneBorderPlaylists() lipgloss.Color // Blue accent
PaneBorderAlbums() lipgloss.Color // Cyan accent
PaneBorderLikedSongs() lipgloss.Color // Green accent
PaneBorderRecentlyPlayed() lipgloss.Color // Teal accent
PaneBorderTopTracks() lipgloss.Color // Purple accent
PaneBorderTopArtists() lipgloss.Color // Pink/red accent
PaneBorderRequestFlow() lipgloss.Color // Orange/amber accent
PaneBorderNetworkLog() lipgloss.Color // Warm grey accent
// Column colors — distinct foreground for each table column semantic (Feature 70)
ColumnIndex() lipgloss.Color // # column (muted but colorful)
ColumnPrimary() lipgloss.Color // Main data: track name, playlist name
ColumnSecondary() lipgloss.Color // Supporting: artist, genre
ColumnTertiary() lipgloss.Color // Metadata: duration, year, played time
// CLI accent — used by cliout palette resolution in "theme" mode (Story 146).
// Optional in TOML; implementations fall back to SeekBar() when "accent" is unset.
Accent() lipgloss.Color
// Metadata
ID() string // Config key matching the TOML id field (e.g. "black", "dracula")
Name() string // Display name: "True Black", "Monokai", etc.
}
Theme defines all colour tokens used across the UI. Components call these methods — they never use raw hex strings.