themes

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderHeight = 3
	FooterHeight = 2
)

Variables

This section is empty.

Functions

func AllThemes

func AllThemes() map[string]ThemeFunc

Types

type ColorPalette

type ColorPalette struct {
	Primary   string `json:"primary"   yaml:"primary"`
	Secondary string `json:"secondary" yaml:"secondary"`
	Tertiary  string `json:"tertiary"  yaml:"tertiary"`
	Success   string `json:"success"   yaml:"success"`
	Warning   string `json:"warning"   yaml:"warning"`
	Error     string `json:"error"     yaml:"error"`
	Info      string `json:"info"      yaml:"info"`
	Body      string `json:"body"      yaml:"body"`
	Emphasis  string `json:"emphasis"  yaml:"emphasis"`
	Border    string `json:"border"    yaml:"border"`

	Black string `json:"black" yaml:"black"`
	White string `json:"white" yaml:"white"`
	Gray  string `json:"gray"  yaml:"gray"`

	// see https://github.com/alecthomas/chroma
	ChromaCodeStyle string `json:"chromaCodeStyle" yaml:"chromaCodeStyle"`
}

func ReadColorPalette

func ReadColorPalette(file string) (*ColorPalette, error)

func WithDefaultColors

func WithDefaultColors(orig ColorPalette) ColorPalette

func (ColorPalette) BlackColor

func (cp ColorPalette) BlackColor() lipgloss.Color

func (ColorPalette) BodyColor

func (cp ColorPalette) BodyColor() lipgloss.Color

func (ColorPalette) BorderColor

func (cp ColorPalette) BorderColor() lipgloss.Color

func (ColorPalette) EmphasisColor

func (cp ColorPalette) EmphasisColor() lipgloss.Color

func (ColorPalette) ErrorColor

func (cp ColorPalette) ErrorColor() lipgloss.Color

func (ColorPalette) GrayColor

func (cp ColorPalette) GrayColor() lipgloss.Color

func (ColorPalette) InfoColor

func (cp ColorPalette) InfoColor() lipgloss.Color

func (ColorPalette) PrimaryColor

func (cp ColorPalette) PrimaryColor() lipgloss.Color

func (ColorPalette) SecondaryColor

func (cp ColorPalette) SecondaryColor() lipgloss.Color

func (ColorPalette) SuccessColor

func (cp ColorPalette) SuccessColor() lipgloss.Color

func (ColorPalette) TertiaryColor

func (cp ColorPalette) TertiaryColor() lipgloss.Color

func (ColorPalette) WarningColor

func (cp ColorPalette) WarningColor() lipgloss.Color

func (ColorPalette) WhiteColor

func (cp ColorPalette) WhiteColor() lipgloss.Color

type OutputLevel

type OutputLevel string
const (
	OutputLevelSuccess OutputLevel = "success"
	OutputLevelNotice  OutputLevel = "notice"
	OutputLevelInfo    OutputLevel = "info"
	OutputLevelWarning OutputLevel = "warning"
	OutputLevelError   OutputLevel = "error"

	// LogNoticeLevel is a custom log level for notices.
	LogNoticeLevel = log.InfoLevel + 1
)

type Theme

type Theme interface {
	String() string
	ColorPalette() *ColorPalette

	RenderBold(text string) string
	RenderInfo(text string) string
	RenderNotice(text string) string
	RenderSuccess(text string) string
	RenderWarning(text string) string
	RenderError(text string) string
	RenderEmphasis(text string) string
	RenderUnknown(text string) string
	RenderLevel(str string, lvl OutputLevel) string
	RenderHeader(appName, stateKey, stateVal string, width int) string
	RenderFooter(text string, width int) string
	RenderKeyAndValue(key, value string) string
	RenderKeyAndValueWithBreak(key, value string) string
	RenderInputForm(text string) string
	RenderInContainer(text string) string

	Spinner() spinner.Spinner
	SpinnerStyle() lipgloss.Style
	EntityViewStyle() lipgloss.Style
	CollectionStyle() lipgloss.Style
	BoxStyle() lipgloss.Style
	ListStyles() list.Styles
	ListItemStyles() list.DefaultItemStyles

	LoggerStyles() *log.Styles
	GlamourMarkdownStyleJSON() (string, error)
	HuhTheme() *huh.Theme
}

func DarkTheme

func DarkTheme() Theme

DarkTheme Use colors from Glamour Dracula theme See https://raw.githubusercontent.com/charmbracelet/glamour/refs/heads/master/styles/dark.json

func DraculaTheme

func DraculaTheme() Theme

DraculaTheme Use colors from Glamour Dracula theme See https://raw.githubusercontent.com/charmbracelet/glamour/refs/heads/master/styles/dracula.json

func EverforestTheme

func EverforestTheme() Theme

EverforestTheme Uses the colors from the Everforest color scheme See https://gogh-co.github.io/Gogh/

func LightTheme

func LightTheme() Theme

LightTheme Use colors from Glamour Light theme See https://raw.githubusercontent.com/charmbracelet/glamour/refs/heads/master/styles/light.json

func NewTheme

func NewTheme(name string, cp ColorPalette) Theme

func TokyoNightTheme

func TokyoNightTheme() Theme

TokyoNightTheme Use colors from Glamour Tokyo Night theme See https://raw.githubusercontent.com/charmbracelet/glamour/refs/heads/master/styles/tokyo-night.json

type ThemeFunc

type ThemeFunc func() Theme

Jump to

Keyboard shortcuts

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