Files
lazygit/pkg/theme/gocui_test.go
T
Stefan HallerandClaude Opus 5.5 8e1f652a35 Allow dim in theme colors
The faint attribute makes text recede on dark and light backgrounds
alike, without having to pick a gray for each. Let users use it in the
theme.

Some theme colors go through both GetTextStyle and GetGocuiStyle, so
both have to know it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 08:16:06 +02:00

44 lines
947 B
Go

package theme
import (
"testing"
"github.com/jesseduffield/lazygit/pkg/gocui"
"github.com/stretchr/testify/assert"
)
func TestGetGocuiStyle(t *testing.T) {
scenarios := []struct {
name string
keys []string
expected gocui.Attribute
}{
{
name: "named color",
keys: []string{"red"},
expected: gocui.ColorRed,
},
{
name: "named color with modifiers",
keys: []string{"red", "bold", "underline"},
expected: gocui.ColorRed | gocui.AttrBold | gocui.AttrUnderline,
},
{
name: "strikethrough",
keys: []string{"red", "strikethrough"},
expected: gocui.ColorRed | gocui.AttrStrikeThrough,
},
{
name: "dim",
keys: []string{"default", "dim"},
expected: gocui.ColorDefault | gocui.AttrDim,
},
}
for _, scenario := range scenarios {
t.Run(scenario.name, func(t *testing.T) {
assert.Equal(t, scenario.expected, GetGocuiStyle(scenario.keys))
})
}
}