theme

package
v0.1.0-pre-release-v4 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

internal/theme/loader.go

internal/theme/manager.go

internal/theme/theme.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetCurrentTheme

func SetCurrentTheme(theme *Theme)

Types

type CommandFunc

type CommandFunc = func(args []string) error

CommandFunc defines the signature for theme commands

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager holds loaded themes and manages the active theme.

func NewManager

func NewManager() *Manager

NewManager creates and initializes a theme manager.

func (*Manager) Current

func (m *Manager) Current() *Theme

Current returns the currently active theme.

func (*Manager) GetTheme

func (m *Manager) GetTheme(name string) (*Theme, bool)

GetTheme returns a specific theme by name (case-insensitive).

func (*Manager) ListThemes

func (m *Manager) ListThemes() []string

ListThemes returns the names of all loaded themes.

func (*Manager) LoadThemesFromDir

func (m *Manager) LoadThemesFromDir() error

LoadThemesFromDir scans the themes directory and loads .toml files.

func (*Manager) SaveCurrentThemeAsDefault

func (m *Manager) SaveCurrentThemeAsDefault() error

SaveCurrentThemeAsDefault saves the current theme as theme.toml (public version)

func (*Manager) SaveThemeToFile

func (m *Manager) SaveThemeToFile(themeName, fileName string) error

SaveThemeToFile saves a theme to a TOML file in the themes directory

func (*Manager) SetTheme

func (m *Manager) SetTheme(name string) error

SetTheme sets the active theme by name (case-insensitive).

func (*Manager) WatchForChanges

func (m *Manager) WatchForChanges() error

WatchForChanges sets up filesystem monitoring for theme directory changes This would allow real-time reloading of themes when files change

type Theme

type Theme struct {
	Name   string
	IsDark bool
	Styles map[string]tcell.Style
}

Theme struct definition (remains the same)

var CurrentTheme *Theme

CurrentTheme, GetCurrentTheme, SetCurrentTheme (remain the same)

var DevComfortDark Theme // Define variable for this theme

func GetCurrentTheme

func GetCurrentTheme() *Theme

func LoadThemeFromFile

func LoadThemeFromFile(filePath string) (*Theme, error)

LoadThemeFromFile parses a TOML file and converts it to a Theme object

func (*Theme) GetStyle

func (t *Theme) GetStyle(name string) tcell.Style

GetStyle method (remains the same - using base name fallback is good)

type ThemeAPI

type ThemeAPI interface {
	GetTheme() *Theme
	SetTheme(name string) error
	ListThemes() []string
	SetStatusMessage(format string, args ...interface{})
}

ThemeAPI interface for theme operations

type TomlStyleDef

type TomlStyleDef struct {
	Fg        *string `toml:"fg"` // Use pointers to detect missing values
	Bg        *string `toml:"bg"`
	Bold      *bool   `toml:"bold"`
	Italic    *bool   `toml:"italic"`
	Underline *bool   `toml:"underline"`
	Reverse   *bool   `toml:"reverse"`
}

TomlStyleDef represents a single style definition in the TOML file

type TomlTheme

type TomlTheme struct {
	Name   string                  `toml:"name"`
	IsDark bool                    `toml:"is_dark"` // Default is false if missing
	Styles map[string]TomlStyleDef `toml:"styles"`
}

TomlTheme represents the structure of a theme file

Jump to

Keyboard shortcuts

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