(colorConstant string)
| 68 | var guiColors map[string]map[string]Color |
| 69 | |
| 70 | func getThemeColor(colorConstant string) Color { |
| 71 | |
| 72 | currentTheme := globals.Settings.Get(SettingsTheme).AsString() |
| 73 | |
| 74 | if _, exists := guiColors[currentTheme]; !exists { |
| 75 | globals.Settings.Get(SettingsTheme).Set("Sunlight") |
| 76 | globals.EventLog.Log("WARNING: Theme [%s] no longer exists in themes directory. Defaulting to 'Sunlight' theme.", true, currentTheme) |
| 77 | currentTheme = "Sunlight" |
| 78 | } |
| 79 | |
| 80 | theme := guiColors[currentTheme] |
| 81 | color, exists := theme[colorConstant] |
| 82 | |
| 83 | if !exists { |
| 84 | globals.EventLog.Log("WARNING: The color for element [%s] doesn't exist for the current theme [%s].", true, colorConstant, currentTheme) |
| 85 | theme[colorConstant] = NewColor(255, 0, 255, 255) |
| 86 | color = theme[colorConstant] // Bright pink for maximum "YOU HAVE TO IMPLEMENT THIS" energy |
| 87 | } |
| 88 | |
| 89 | return color.Clone() |
| 90 | } |
| 91 | |
| 92 | func refreshThemes() { |
| 93 | globals.MenuSystem.Recreate() |
no test coverage detected