fix: the selected row is a shade of the background, in every pane (#22)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit was merged in pull request #22.
This commit is contained in:
1 parent
b530c043f7
commit
fcd4fcb783
5 files changed
+68
-4
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package styles
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -62,3 +63,32 @@ func TestEmptyThemeIsDefault(t *testing.T) {
|
||||
t.Errorf("empty theme: %v %v reverse=%v bg=%v", err, fg, st.Selected.GetReverse(), st.Selected.GetBackground())
|
||||
}
|
||||
}
|
||||
|
||||
func TestOnBackground(t *testing.T) {
|
||||
hex := func(c any) string {
|
||||
r, g, b, _ := c.(interface{ RGBA() (r, g, b, a uint32) }).RGBA()
|
||||
return fmt.Sprintf("#%02x%02x%02x", r>>8, g>>8, b>>8)
|
||||
}
|
||||
st := Default().OnBackground(lipgloss.Color("#282c34"), true)
|
||||
if got := hex(st.Selected.GetBackground()); got != "#3e424a" {
|
||||
t.Errorf("dark: selected %s", got)
|
||||
}
|
||||
if got := hex(st.SelectedBlurred.GetBackground()); got != "#343840" {
|
||||
t.Errorf("dark: blurred %s", got)
|
||||
}
|
||||
if got := hex(Default().OnBackground(lipgloss.Color("#ffffff"), false).Selected.GetBackground()); got != "#e8e8e8" {
|
||||
t.Errorf("light: selected %s", got)
|
||||
}
|
||||
|
||||
themed, _, err := FromTheme(map[string][]string{"selectedLineBgColor": {"#2d3f76"}})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
st = themed.OnBackground(lipgloss.Color("#282c34"), true)
|
||||
if got := hex(st.Selected.GetBackground()); got != "#2d3f76" {
|
||||
t.Errorf("themed: selected %s (want the theme's)", got)
|
||||
}
|
||||
if got := hex(st.SelectedBlurred.GetBackground()); got != "#343840" {
|
||||
t.Errorf("themed: blurred %s (not themed: shaded)", got)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user