()
| 40 | } |
| 41 | |
| 42 | func initCmdColor() bool { |
| 43 | var err error |
| 44 | |
| 45 | themeName := settingSection.Key("current_theme").String() |
| 46 | |
| 47 | if len(themeName) == 0 { |
| 48 | utils.PrintError(`Config "current_theme" is blank.`) |
| 49 | return false |
| 50 | } |
| 51 | |
| 52 | themeFolder = getThemeFolder(themeName) |
| 53 | |
| 54 | colorPath := filepath.Join(themeFolder, "color.ini") |
| 55 | |
| 56 | colorCfg, err = ini.InsensitiveLoad(colorPath) |
| 57 | if err != nil { |
| 58 | utils.PrintError("Cannot open file " + colorPath) |
| 59 | return false |
| 60 | } |
| 61 | |
| 62 | sections := colorCfg.Sections() |
| 63 | |
| 64 | if len(sections) < 2 { |
| 65 | utils.PrintError("No section found in " + colorPath) |
| 66 | return false |
| 67 | } |
| 68 | |
| 69 | schemeName := settingSection.Key("color_scheme").String() |
| 70 | if len(schemeName) == 0 { |
| 71 | colorSection = sections[1] |
| 72 | } else { |
| 73 | schemeSection, err := colorCfg.GetSection(schemeName) |
| 74 | if err != nil { |
| 75 | colorSection = sections[1] |
| 76 | } else { |
| 77 | colorSection = schemeSection |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | return true |
| 82 | } |
| 83 | |
| 84 | // DisplayColors prints out every color name, hex and rgb value. |
| 85 | func DisplayColors() { |
no test coverage detected