MCPcopy
hub / github.com/spicetify/cli / DisplayColors

Function DisplayColors

src/cmd/color.go:85–118  ·  view source on GitHub ↗

DisplayColors prints out every color name, hex and rgb value.

()

Source from the content-addressed store, hash-verified

83
84// DisplayColors prints out every color name, hex and rgb value.
85func DisplayColors() {
86 if !initCmdColor() {
87 return
88 }
89 data := pterm.TableData{
90 {"Name", "Preview", "Hex", "RGB"},
91 }
92 for _, k := range utils.BaseColorOrder {
93 colorString := colorSection.Key(k).String()
94
95 if len(colorString) == 0 {
96 colorString = utils.BaseColorList[k]
97 k += " (*)"
98 }
99
100 color := utils.ParseColor(colorString)
101 data = append(data, []string{utils.Bold(k), colorPreview(color), color.Hex(), color.RGB()})
102 }
103
104 for _, v := range colorSection.Keys() {
105 k := v.Name()
106
107 if len(utils.BaseColorList[k]) != 0 {
108 continue
109 }
110
111 color := utils.ParseColor(v.String())
112 data = append(data, []string{utils.Bold(k), colorPreview(color), color.Hex(), color.RGB()})
113 }
114
115 pterm.DefaultTable.WithHasHeader().WithData(data).Render()
116
117 utils.PrintNote("(*): Default color is used")
118}
119
120func colorChangeSuccess(field, value string) {
121 utils.PrintSuccess(`Color changed: ` + field + ` = ` + value)

Callers 1

mainFunction · 0.92

Calls 7

ParseColorFunction · 0.92
BoldFunction · 0.92
PrintNoteFunction · 0.92
initCmdColorFunction · 0.85
colorPreviewFunction · 0.85
HexMethod · 0.65
RGBMethod · 0.65

Tested by

no test coverage detected