mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-10-06 05:57:38 -04:00
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>
44 lines
947 B
Go
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))
|
|
})
|
|
}
|
|
}
|