Skip to content

Level Colors

This document goes in depth on how colors, copy colors and player color work as base colors or in color/pulse triggers.

Color classes

There are 3 color classes (not to be confused with the GD’s classes). Every aspect in GD levels that use colors only take one of the classes. All of the properties that do not belong to the color class being used is ignored.

BaseColor

This class contains a static color along with opacity and blending.

These are the properties that are important for a BaseColor:

NameTypeDescription
RedintegerThe red component of the BaseColor. Goes from 0 to 255
GreenintegerThe green component of the BaseColor. Goes from 0 to 255
BlueintegerThe blue component of the BaseColor. Goes from 0 to 255
OpacityfloatThe alpha component of the BaseColor. Goes from 0 to 1
BlendingboolThe blending property of the BaseColor

Note: Blending causes the color to add its color properties by basically using the OpenGL blend mode glBlendFunc(GL_SRC_ALPHA, GL_ONE)

PlayerColor

This class contains a static color refering to one of the player’s icon color along with opacity and blending.

These are the properties that are important for a PlayerColor:

NameTypeDescription
Player ColorintegerThis determines which of the player’s color is getting used. The actual values are not documented here yet.
OpacityfloatThe alpha component of the PlayerColor. Goes from 0 to 1
BlendingboolThe blending property of the PlayerColor

CopyColor

This class contains a dynamic color copied from another color channel. This color changes according to the current color of the channel that is being copied.

NameTypeDescription
Copy Channel IDintegerThe color channel ID that the CopyColor is copying the color from
Copy OpacityboolThis determines whenever CopyColor should also copy the opacity belonging to the color channel in Copy Color ID
OpacityfloatThe alpha component of the Copy Color. If Copy Opacity is true. This property is ignored.
BlendingboolThe blending property of the CopyColor since it cannot be copied
Copy HSVHSVThe HSV property that changes the color’s tint depending on the value

Determining which class is used

Here is a simple JavaScript function that determines what color class the color object has:

function getColorClass(color) {
if (color.copy_channel_id != 0)
return COPY_COLOR;
if (color.player_color != PLAYER_COLOR_NONE)
return PLAYER_COLOR;
return BASE_COLOR;
}

Color Channel ID’s

Here are all of the different color id’s:

IntervalNameDescription
1 - 999Custom colorsThese are the colors that are avalible for the creator to use
1000BGThis is the color of the background
1001G1This is the primary color of the ground
1002LineThis is the color of the ground line
10033DLThis is the color of the 3D line objects
1004ObjThis is the OBJ color
1005P1This is the static color channel refering to the primary color of the player’s icon
1006P2This is the static color channel refering to the secondary color of the player’s icon
1007LBGThis is the static color channel that is a lighter version of BG
1009G2This is the secondary color of the ground
1010BlackThis is the static color channel which is always r: 0, g: 0, b: 0. Used in saws that are black by default
1011WhiteThis is the static color channel which is always r: 255, g: 255, b: 255.
1012LighterA lighter version of the primary color in objects. Used in the white small blocks found in build tab 2 on page 6.
1013MGThis is the primary color of the middleground
1014MG2This is the secondary color of the middleground

1.9 color channel ID’s

GD’s 1.9 version used a different ID scheme to identify color channels. In 2.0+, these IDs are still present, but only used in the legacy 1.9 Color Channel ID property of 1.9 objects. They are as follows:

1.9 Channel IDNameCorresponding 2.0+ ID
1P11005
2P21006
3COL 11
4COL 22
5LBG1007
6COL 33
7COL 44
83DL1003

Light Background (LBG) calculation

The LBG takes the HSV of background. Subtracts 20 from its saturation, then interpolates from P1 to the last HSV by a factor of the last HSV’s value devided by 100.

Here is a JavaScript example:

function lightBG(bg, p1) {
let hsv = RGBtoHSV(bg);
hsv.s -= 20;
return blendColor( p1, HSVtoRGB(hsv), hsv.v / 100 );
}