Fixed dark and light themes, ui.theme auto/dark/light
Colors no longer come from the terminal's palette, whose color 0 many color themes set to a grey that is not their background. A theme sets tview's default styles and the color names used in texts, all chosen from entries 16-255 of the 256-color table so terminals without 24-bit color show them exactly. "auto" picks light or dark from the background color the terminal reports. Settable in the Config view, applied at the next start (widgets copy their colors when created). Replaces using the terminal's own background and text colors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019reK4DUGYqDUjniWYJvwUW
This commit is contained in:
+7
-6
@@ -100,9 +100,10 @@ type overlay struct {
|
||||
|
||||
// New builds the application shell: a tab bar, one page per view and a status bar.
|
||||
func New(cfg *config.Config) *App {
|
||||
// Ask the terminal before the screen takes it over and before any widget
|
||||
// copies the default background.
|
||||
backgroundNote := useTerminalBackground(terminalAnswers(), os.Getenv)
|
||||
// Ask the terminal before the screen takes it over, and set the colors
|
||||
// before any widget copies them.
|
||||
th, themeNote := chooseTheme(cfg.UI.Theme, terminalAnswers())
|
||||
th.apply()
|
||||
a := &App{
|
||||
app: tview.NewApplication(),
|
||||
tabs: tview.NewTextView().SetDynamicColors(true),
|
||||
@@ -139,7 +140,7 @@ func New(cfg *config.Config) *App {
|
||||
if a.covers {
|
||||
a.logs.add(levelInfo, coverNote)
|
||||
}
|
||||
a.logs.add(levelInfo, backgroundNote)
|
||||
a.logs.add(levelInfo, themeNote)
|
||||
sabClient := sabnzbd.NewClient(cfg.SABnzbd.URL, cfg.SABnzbd.APIKey)
|
||||
a.sab = sabClient
|
||||
a.probes = []probe{
|
||||
@@ -588,11 +589,11 @@ func (a *App) renderTabs() {
|
||||
for i, v := range a.views {
|
||||
switch {
|
||||
case a.narrow && i == a.active:
|
||||
s += fmt.Sprintf(activeTabTag+"%c %s[-:-] ", v.key, v.name)
|
||||
s += fmt.Sprintf("[black:white]%c %s[-:-] ", v.key, v.name)
|
||||
case a.narrow:
|
||||
s += fmt.Sprintf("[gray]%c %s[-] ", v.key, v.name)
|
||||
case i == a.active:
|
||||
s += fmt.Sprintf(activeTabTag+" %c %s [-:-] ", v.key, v.name)
|
||||
s += fmt.Sprintf("[black:white] %c %s [-:-] ", v.key, v.name)
|
||||
default:
|
||||
s += fmt.Sprintf("[gray] %c %s [-]", v.key, v.name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user