feat(theme): add catppuccin themes with transparency and 256-color support
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.
This commit is contained in:
@@ -2,6 +2,7 @@ package compact
|
||||
|
||||
import (
|
||||
"github.com/bcicen/ctop/models"
|
||||
"github.com/bcicen/ctop/theme"
|
||||
|
||||
ui "github.com/gizak/termui"
|
||||
)
|
||||
@@ -45,7 +46,7 @@ func (s *Status) Header() string { return "" }
|
||||
func (s *Status) FixedWidth() int { return 3 }
|
||||
|
||||
func (s *Status) setState(val string) {
|
||||
color := ui.ColorDefault
|
||||
color := theme.Attr("text")
|
||||
var mark string
|
||||
|
||||
switch val {
|
||||
@@ -66,11 +67,11 @@ func (s *Status) setState(val string) {
|
||||
log.Warningf("unknown status string: \"%v\"", val)
|
||||
}
|
||||
|
||||
s.status = ui.TextCells(mark, color, ui.ColorDefault)
|
||||
s.status = ui.TextCells(mark, color, theme.Attr("bg"))
|
||||
}
|
||||
|
||||
func (s *Status) setHealth(val string) {
|
||||
color := ui.ColorDefault
|
||||
color := theme.Attr("text")
|
||||
var mark string
|
||||
|
||||
switch val {
|
||||
@@ -90,5 +91,5 @@ func (s *Status) setHealth(val string) {
|
||||
log.Warningf("unknown health state string: \"%v\"", val)
|
||||
}
|
||||
|
||||
s.health = ui.TextCells(mark, color, ui.ColorDefault)
|
||||
s.health = ui.TextCells(mark, color, theme.Attr("bg"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user