Class ColorProvider

#include <Geode/utils/ColorProvider.hpp>
classColorProvider{ ... }

GD has a lot of hardcoded colors. In addition, mods may very well also use hardcoded colors in their UIs, for example for CCLayerColors. This makes it hard for texture packs to reliably change colors, since they’d have to manually deal with every mod.

To help with this, Geode provides the [ColorProvider](/classes/geode/ColorProvider) class, which is just an index of colors with associated IDs. Mods should use this to define their hardcoded colors for their UIs, and texture packs can then change the color dynamically.

Mods are not expected to handle in-game color changes, since in nearly all cases the texture pack will be applied far from the mod’s UI and as such just getting the defined color on layer enter will be more than enough. However, if the mod does add some static UI that won’t be naturally refreshed after a texture pack is applied, it should listen for [ColorProvidedEvent](/classes/geode/ColorProvidedEvent)s to react accordingly.

Examples0
Public static methods1
staticgeode::ColorProvider*get()
No description provided
Public member functions7
cocos2d::ccColor4Bdefine(,)

Define a new color with an associated ID. The ID should be prefixed with the mod ID. If the color has already been defined, nothing happens

Parameters

id

The ID of the color; should be prefixed with mod ID

color

The color
Return value
The current value of the color with the ID (same as the `color` function)
cocos2d::ccColor3Bdefine(,)

Define a new color with an associated ID. The ID should be prefixed with the mod ID. If the color has already been defined, nothing happens

Parameters

id

The ID of the color; should be prefixed with mod ID

color

The color. Alpha component is assumed to be 255
Return value
The current value of the color with the ID (same as the `color` function, although with the value truncated to cc3b)
cocos2d::ccColor4Boverride(,)

Override the current value of a color with an associated ID

Parameters

id

The ID of the color

color

The color to override with
Return value
The new value of the color, or ccWHITE if the ID doesn't exist
cocos2d::ccColor3Boverride(,)

Override the current value of a color with an associated ID

Parameters

id

The ID of the color

color

The color to override with. Alpha component is assumed to be 255
Return value
The new value of the color, or ccWHITE if the ID doesn't exist (truncated to cc3b)
cocos2d::ccColor4Breset()

Reset the current value of a color to its original definition

Parameters

id

The ID of the color
Return value
The original value of the color, or ccWHITE if the ID doesn't exist
cocos2d::ccColor4Bcolor()const

Get the current value of a color

Parameters

id

The ID of the color
Return value
The value of the color, or ccWHITE if the ID doesn't exist
cocos2d::ccColor3Bcolor3b()const

Get the current value of a color as a ccColor3B

Parameters

id

The ID of the color
Return value
The value of the color, or ccWHITE if the ID doesn't exist
Fields0
Protected member functions0
Protected fields0