theme

package
v0.0.0-...-3b1bfa6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SourceDefault = "default"
	SourceLocal   = "local"
	SourceRemote  = "remote"
)

Theme source constants.

Variables

This section is empty.

Functions

func ThemesDir

func ThemesDir() string

ThemesDir returns the path to ~/.config/mdc/themes/.

Types

type AvailableTheme

type AvailableTheme struct {
	Key     string // config key (filename stem, e.g. "catppuccin-mocha")
	Name    string // display name from TOML "name" field, or filename stem
	Source  string // SourceDefault, SourceLocal, or SourceRemote
	Theme   Theme  // pre-loaded theme
	RawTOML []byte // original TOML content (set for remote themes, used to save locally on select)
}

AvailableTheme represents a discovered theme that can be selected.

func FetchRemoteThemes

func FetchRemoteThemes(localKeys map[string]bool) []AvailableTheme

FetchRemoteThemes fetches theme files from the GitHub repository. localKeys contains keys of themes already available locally; those are skipped. Returns nil on any network or parse error

func ListAvailable

func ListAvailable() []AvailableTheme

ListAvailable returns all available themes: the hardcoded default plus any TOML files found in ~/.config/mdc/themes/.

func ParseTOML

func ParseTOML(key string, data []byte) (AvailableTheme, error)

ParseTOML parses raw TOML bytes into an AvailableTheme.

type Theme

type Theme struct {
	// Panel
	PanelBorder       lipgloss.Style
	PanelBorderActive lipgloss.Style
	PanelHeader       lipgloss.Style
	PanelHeaderActive lipgloss.Style

	// File list
	FileNormal    lipgloss.Style
	FileDir       lipgloss.Style
	FileExec      lipgloss.Style
	FileSymlink   lipgloss.Style
	FileCursor    lipgloss.Style
	FileCursorDir lipgloss.Style
	FileSelected  lipgloss.Style

	// Status bar and menu bar
	StatusBar lipgloss.Style
	MenuBar   lipgloss.Style
	FKeyHint  lipgloss.Style
	FKeyLabel lipgloss.Style

	// Command line
	CmdLine lipgloss.Style
}

Theme holds all styles used by the application.

func Default

func Default() Theme

Default returns the classic MC-like theme.

func LoadByName

func LoadByName(name string) (Theme, error)

LoadByName loads a theme by name from ~/.config/mdc/themes/<name>.toml.

func LoadFromFile

func LoadFromFile(path string) (Theme, error)

LoadFromFile loads a theme from a TOML file, falling back to Default() for missing values.

type ThemeFile

type ThemeFile struct {
	Name    string            `toml:"name"`
	Palette map[string]string `toml:"palette"`
	Panel   panelTOML         `toml:"panel"`
	Status  sectionTOML       `toml:"statusbar"`
	Menu    menuTOML          `toml:"menubar"`
}

ThemeFile is the TOML structure for a theme file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL