/
githubmirror
/
lazygit
Обзор
Документация
Войти
/
githubmirror
/
lazygit
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
pkg/theme/style.go
44 строки
860 B
Jesse Duffield
Support strikethrough text style
21 май 2023, 03:46
21 май 2023, 03:46
820f7b9
Код
Авторство
О чём код?
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 "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 }