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

Function EditColor

src/cmd/color.go:12–40  ·  view source on GitHub ↗

EditColor changes one or multiple colors' values

(args []string)

Source from the content-addressed store, hash-verified

10
11// EditColor changes one or multiple colors' values
12func EditColor(args []string) {
13 if !initCmdColor() {
14 return
15 }
16
17 for len(args) >= 2 {
18 field := args[0]
19 value := args[1]
20 args = args[2:]
21
22 color := utils.ParseColor(value).Hex()
23
24 if key, err := colorSection.GetKey(field); err == nil {
25 key.SetValue(color)
26 colorChangeSuccess(field, color)
27 continue
28 }
29
30 if len(utils.BaseColorList[field]) > 0 {
31 colorSection.NewKey(field, color)
32 colorChangeSuccess(field, color)
33 continue
34 }
35
36 utils.PrintWarning(`Color "` + field + `" unchanged: Not found.`)
37 }
38
39 colorCfg.SaveTo(filepath.Join(themeFolder, "color.ini"))
40}
41
42func initCmdColor() bool {
43 var err error

Callers 1

mainFunction · 0.92

Calls 5

ParseColorFunction · 0.92
PrintWarningFunction · 0.92
initCmdColorFunction · 0.85
colorChangeSuccessFunction · 0.85
HexMethod · 0.65

Tested by

no test coverage detected