MCPcopy
hub / github.com/jesseduffield/lazygit / GetTextStyle

Function GetTextStyle

pkg/theme/style.go:9–44  ·  view source on GitHub ↗
(keys []string, background bool)

Source from the content-addressed store, hash-verified

7)
8
9func GetTextStyle(keys []string, background bool) style.TextStyle {
10 s := style.New()
11
12 for _, key := range keys {
13 switch key {
14 case "bold":
15 s = s.SetBold()
16 case "reverse":
17 s = s.SetReverse()
18 case "underline":
19 s = s.SetUnderline()
20 case "strikethrough":
21 s = s.SetStrikethrough()
22 default:
23 value, present := style.ColorMap[key]
24 if present {
25 var c style.TextStyle
26 if background {
27 c = value.Background
28 } else {
29 c = value.Foreground
30 }
31 s = s.MergeStyle(c)
32 } else if utils.IsValidHexValue(key) {
33 c := style.NewRGBColor(color.HEX(key, background))
34 if background {
35 s = s.SetBg(c)
36 } else {
37 s = s.SetFg(c)
38 }
39 }
40 }
41 }
42
43 return s
44}

Callers 2

UpdateThemeFunction · 0.85
TestGetTextStyleFunction · 0.85

Calls 10

NewFunction · 0.92
IsValidHexValueFunction · 0.92
NewRGBColorFunction · 0.92
MergeStyleMethod · 0.80
SetBgMethod · 0.80
SetFgMethod · 0.80
SetBoldMethod · 0.45
SetReverseMethod · 0.45
SetUnderlineMethod · 0.45
SetStrikethroughMethod · 0.45

Tested by 1

TestGetTextStyleFunction · 0.68