theme

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package theme provides centralized styling and theming functionality

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListInstalled

func ListInstalled(configDir string, logger loggerInterface) []string

ListInstalled returns a list of available theme names.

func Load

func Load(configDir, themeName string, logger loggerInterface) error

Load loads a theme from file or falls back to default.

func Set

func Set(theme *Theme)

Set sets the current application theme.

Types

type AdaptiveColor

type AdaptiveColor struct {
	Light string `json:"light"`
	Dark  string `json:"dark"`
}

AdaptiveColor supports both light and dark theme variants.

type AppStyles

type AppStyles struct {
	Input        InputStyles
	List         list.Styles
	ListDelegate list.DefaultItemStyles
	ListHelp     help.Styles
	EditForm     EditForm
	ListExtra    ListExtraStyles
}

AppStyles contains all computed styles for the application.

type ColorsList

type ColorsList struct {
	TextColor            AdaptiveColor `json:"textColor"`
	TextColorError       AdaptiveColor `json:"textColorError"`
	TextColorReadonly    AdaptiveColor `json:"textColorReadonly"`
	TextColorSelected1   AdaptiveColor `json:"textColorSelected1"`
	TextColorSelected2   AdaptiveColor `json:"textColorSelected2"`
	TextColorTitle       AdaptiveColor `json:"textColorTitle"`
	BackgroundColorTitle AdaptiveColor `json:"backgroundColorTitle"`
}

ColorsList defines all colors which can be overridden in the application.

type EditForm

type EditForm struct {
	SelectedTitle lipgloss.Style
	Title         lipgloss.Style
	TextReadonly  lipgloss.Style
}

EditForm contains styles for host edit components.

type InputStyles

type InputStyles struct {
	InputFocused lipgloss.Style
	InputError   lipgloss.Style
	TextFocused  lipgloss.Style
	TextReadonly lipgloss.Style
	TextNormal   lipgloss.Style
}

InputStyles contains styles for input components.

type ListExtraStyles

type ListExtraStyles struct {
	Cursor            lipgloss.Style
	GroupAbbreviation lipgloss.Style
	GroupHint         lipgloss.Style
	Prompt            lipgloss.Style
	FilterInput       lipgloss.Style
	// These 2 paginator styles are string values.
	PaginatorActiveDot   string
	PaginatorInactiveDot string
}

type Theme

type Theme struct {
	Name        string     `json:"name"`
	Description string     `json:"description"`
	Colors      ColorsList `json:"colors"`
	Styles      AppStyles  `json:"-"` // Not serialized, computed from colors
}

Theme defines the color scheme and styling for the application.

func DefaultTheme

func DefaultTheme() *Theme

DefaultTheme returns the default application theme. See cheat-sheet: https://www.ditig.com/publications/256-colors-cheat-sheet

func Get

func Get() *Theme

Get returns the current application theme. This method is used only by styles module. Consider refactoring.

Jump to

Keyboard shortcuts

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