Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Palettes and Remaps
OpenRA loads native RA/CnC palettes which are a list of 256 colors in the Westwood PAL format.
Certain color indices have hard-coded meanings as transparent or shadow colors. Index 0 is always mapped to transparent. The color (index) that is mapped to transparency can be custom defined in
See the traits documentation for detailed developer commentary.
Palettes must be defined with a trait before they can be used ingame. The Name field is used both by internal palette lookups, and by custom palette overrides on unit Render* traits.
RA/CnC ShadowIndex is both at 4, the color does not matter as it is replaced by the engine. 3 is used by the GPS dots that were introduced in OpenRA.
The index that is mapped to a transparent shadow can also be defined in
PaletteFromCurrentTileset trait loads the palette specified in the current tileset definition.
PaletteFromRGBA creates a single color palette without any base palette file. This is used to define the palettes for iron curtain and low-power.
FogPalette add the hard-coded fog and shroud palettes to the game.
Player color palettes
Player palettes work slightly differently to the other palette definitions. The
PlayerColorPalette trait is added to the Player actor definition.
This trait takes the specified base palette and remap index. It and creates a palette for each player in the game using the color they chose in the lobby. Internally, each definition is mapped to N "normal" palettes named i where i is the player index from [0-N). Multiple per-player palettes can be defined by adding multiple PlayerColorPalette traits to the player actor.
OpenRA supports remappable ranges for player colors that can be defined RemapIndex with .
ra: A ramp of 16 colors, starting at index 80 (default):
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95
d2k: A reversed ramp of 16 colors, starting at index 255:
255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240
cnc: Two ramps of 8 colors each, starting at index 176:
176, 178, 180, 182, 184, 186, 189, 191, 177, 179, 181, 183, 185, 187, 188, 190
terrainis used as a basis for the player palette (requires remapping)
playeris the default name for the remapped player color palette
chromeis used for icons
effectis used for explosions, bullet traces, etc.
shadowis a transparent grey color for shadows (airplanes, buildings)
cloakis the color seen by the owner of invisible units
invulnis the color used for the iron curtain in RA
disabledis the color buildings that are powered down
Using custom palettes
Actor rendering is handled by the family of the Render* traits. The behavior for specifying custom palettes is defined in the common base class to these traits, which means that it is the same for all of the Render* traits.
Render* will render the unit with the default player palette by default. This can be overridden with a custom player palette by adding a PlayerPalette override that gives the BaseName of the desired PlayerColorPalette.
If you want to disable player colors, you can also specify a static palette by overriding the Palette with the name of the palette to use.