Files
lazygit/pkg/theme/style.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

47 lines
892 B
Go

package theme
import (
"github.com/gookit/color"
"github.com/jesseduffield/lazygit/pkg/gui/style"
"github.com/jesseduffield/lazygit/pkg/utils"
)
func GetTextStyle(keys []string, background bool) style.TextStyle {
s := style.New()
for _, key := range keys {
switch key {
case "bold":
s = s.SetBold()
case "dim":
s = s.SetDim()
case "reverse":
s = s.SetReverse()
case "underline":
s = s.SetUnderline()
case "strikethrough":
s = s.SetStrikethrough()
default:
value, present := style.ColorMap[key]
if present {
var c style.TextStyle
if background {
c = value.Background
} else {
c = value.Foreground
}
s = s.MergeStyle(c)
} else if utils.IsValidHexValue(key) {
c := style.NewRGBColor(color.HEX(key, background))
if background {
s = s.SetBg(c)
} else {
s = s.SetFg(c)
}
}
}
}
return s
}