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>
This commit is contained in:
Stefan Haller
2026-09-27 08:16:06 +02:00
co-authored by Claude Opus 5.5
parent c236214c29
commit 8e1f652a35
5 changed files with 15 additions and 0 deletions
+1
View File
@@ -1017,6 +1017,7 @@ The available attributes are:
- bold
- default
- dim # faint text; not supported by every terminal
- reverse # useful for high-contrast
- underline
- strikethrough
+1
View File
@@ -17,6 +17,7 @@ var gocuiColorMap = map[string]gocui.Attribute{
"cyan": gocui.ColorCyan,
"white": gocui.ColorWhite,
"bold": gocui.AttrBold,
"dim": gocui.AttrDim,
"reverse": gocui.AttrReverse,
"underline": gocui.AttrUnderline,
"strikethrough": gocui.AttrStrikeThrough,
+5
View File
@@ -28,6 +28,11 @@ func TestGetGocuiStyle(t *testing.T) {
keys: []string{"red", "strikethrough"},
expected: gocui.ColorRed | gocui.AttrStrikeThrough,
},
{
name: "dim",
keys: []string{"default", "dim"},
expected: gocui.ColorDefault | gocui.AttrDim,
},
}
for _, scenario := range scenarios {
+2
View File
@@ -13,6 +13,8 @@ func GetTextStyle(keys []string, background bool) style.TextStyle {
switch key {
case "bold":
s = s.SetBold()
case "dim":
s = s.SetDim()
case "reverse":
s = s.SetReverse()
case "underline":
+6
View File
@@ -39,6 +39,12 @@ func TestGetTextStyle(t *testing.T) {
background: false,
expected: style.New().SetFg(style.NewRGBColor(color.RGBColor{0x12, 0x34, 0x56, 0})),
},
{
name: "dim",
keys: []string{"dim"},
background: false,
expected: style.New().SetDim(),
},
{
name: "hex color, bg",
keys: []string{"#abcdef"},