Add a theme package providing all four catppuccin flavors (mocha, frappe, macchiato, latte) mapped to the xterm-256 palette. Themes are selected with -theme or the CTOP_THEME environment variable; -i inverts the flavor. Background slots use the terminal's native color for transparency (opt out with -solid / CTOP_SOLID), and termbox is switched to Output256 so colors render correctly. Replace hardcoded colors in the compact and single views with ctheme portrait slots.
24 lines
461 B
Go
24 lines
461 B
Go
package main
|
|
|
|
import (
|
|
"github.com/bcicen/ctop/theme"
|
|
|
|
ui "github.com/gizak/termui"
|
|
)
|
|
|
|
var ColorMap map[string]ui.Attribute
|
|
|
|
// SetColorMap installs the color scheme for the currently selected theme
|
|
func SetColorMap() {
|
|
ColorMap = theme.BuildColorMap()
|
|
}
|
|
|
|
// InvertColorMap switches to the inverse (light/dark) flavor
|
|
func InvertColorMap() {
|
|
if theme.Current() == theme.Latte {
|
|
theme.Set(theme.Mocha)
|
|
} else {
|
|
theme.Set(theme.Latte)
|
|
}
|
|
SetColorMap()
|
|
} |