MCPcopy Create free account
hub / github.com/SolarLune/masterplan / getThemeColor

Function getThemeColor

gui.go:70–90  ·  view source on GitHub ↗
(colorConstant string)

Source from the content-addressed store, hash-verified

68var guiColors map[string]map[string]Color
69
70func 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
92func refreshThemes() {
93 globals.MenuSystem.Recreate()

Callers 15

DrawMethod · 0.85
RecreateMethod · 0.85
handleScreenshotsFunction · 0.85
DrawMethod · 0.85
DrawJointMethod · 0.85
DrawCardMethod · 0.85
DrawContentsMethod · 0.85
PostDrawMethod · 0.85
DrawMethod · 0.85
CreateGridTextureMethod · 0.85
DrawGridMethod · 0.85
DrawLabelFunction · 0.85

Calls 6

NewColorFunction · 0.85
AsStringMethod · 0.80
LogMethod · 0.80
GetMethod · 0.45
SetMethod · 0.45
CloneMethod · 0.45

Tested by

no test coverage detected