Documentation
¶
Index ¶
- Variables
- func ColorToHex(color tcell.Color) string
- func GetColor(name string) tcell.Color
- func GetGradientStyle(colors []string, position float64) tcell.Style
- func GetStyle(fg, bg string) tcell.Style
- func LoadDefaultTheme()
- func LoadTheme(path string) error
- func ParseHexColor(hex string) tcell.Color
- func RGBToColor(r, g, b uint64) tcell.Color
- func SaveTheme(path string) error
- type Theme
- func (t *Theme) GetAccentStyle() tcell.Style
- func (t *Theme) GetBorderStyle() tcell.Style
- func (t *Theme) GetGradientStyle(position float64) tcell.Style
- func (t *Theme) GetStyle() tcell.Style
- func (t *Theme) SetAccent(color tcell.Color)
- func (t *Theme) SetBackground(color tcell.Color)
- func (t *Theme) SetBorder(color tcell.Color)
- func (t *Theme) SetForeground(color tcell.Color)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrReadThemeFile is returned when the theme file cannot be read ErrReadThemeFile = errors.New("failed to read theme file") // ErrParseThemeFile is returned when the theme file cannot be parsed ErrParseThemeFile = errors.New("failed to parse theme file") // ErrMarshalTheme is returned when the theme cannot be marshaled ErrMarshalTheme = errors.New("failed to marshal theme") // ErrCreateThemeDir is returned when the theme directory cannot be created ErrCreateThemeDir = errors.New("failed to create theme directory") // ErrWriteThemeFile is returned when the theme file cannot be written ErrWriteThemeFile = errors.New("failed to write theme file") // Current holds the current theme Current Theme )
Functions ¶
func ColorToHex ¶
func ColorToHex(color tcell.Color) string
ColorToHex converts tcell.Color to hex string
func GetColor ¶
func GetColor(name string) tcell.Color
GetColor returns a tcell color from a color name
func GetGradientStyle ¶
GetGradientStyle returns a style based on position in a gradient
func GetStyle ¶
func GetStyle(fg, bg string) tcell.Style
GetStyle returns a tcell.Style with the given foreground and background colors
func ParseHexColor ¶
func ParseHexColor(hex string) tcell.Color
ParseHexColor parses a hex color string into tcell.Color
func RGBToColor ¶
func RGBToColor(r, g, b uint64) tcell.Color
RGBToColor converts RGB values to tcell.Color
Types ¶
type Theme ¶
type Theme struct { Name string `json:"name"` Description string `json:"description"` Author string `json:"author"` Background tcell.Color `json:"-"` Foreground tcell.Color `json:"-"` MainBg tcell.Color `json:"-"` MainFg tcell.Color `json:"-"` Title tcell.Color `json:"-"` Meter []string `json:"meter_bg"` Graph []string `json:"graph"` Border tcell.Color `json:"-"` Selected tcell.Color `json:"-"` HighlightBg tcell.Color `json:"-"` HighlightFg tcell.Color `json:"-"` Accent tcell.Color `json:"-"` // JSON fields for serialization BackgroundHex string `json:"background"` ForegroundHex string `json:"foreground"` MainBgHex string `json:"main_bg"` MainFgHex string `json:"main_fg"` TitleHex string `json:"title"` BorderHex string `json:"border"` SelectedHex string `json:"selected"` HighlightBgHex string `json:"highlight_bg"` HighlightFgHex string `json:"highlight_fg"` AccentHex string `json:"accent"` }
Theme represents a complete color theme
func (*Theme) GetAccentStyle ¶
func (t *Theme) GetAccentStyle() tcell.Style
GetAccentStyle returns the accent style for the theme
func (*Theme) GetBorderStyle ¶
func (t *Theme) GetBorderStyle() tcell.Style
GetBorderStyle returns the border style for the theme
func (*Theme) GetGradientStyle ¶
GetGradientStyle returns a style based on position in a gradient
func (*Theme) GetStyle ¶
func (t *Theme) GetStyle() tcell.Style
GetStyle returns the default style for the theme
func (*Theme) SetAccent ¶
func (t *Theme) SetAccent(color tcell.Color)
SetAccent sets the accent color
func (*Theme) SetBackground ¶
func (t *Theme) SetBackground(color tcell.Color)
SetBackground sets the background color
func (*Theme) SetBorder ¶
func (t *Theme) SetBorder(color tcell.Color)
SetBorder sets the border color
func (*Theme) SetForeground ¶
func (t *Theme) SetForeground(color tcell.Color)
SetForeground sets the foreground color