Colors.gml

This file is used to initialize your character’s alternate color palettes. Custom characters have 6 color slots by default, but they can have up to 16 by the use of set_num_palettes.

To make an alternate color palette, you must reference the default color palette of your character. To make this easier, you can create a table with every color used by the character, organized in rows of colors that will get recolored together.

Each row is a separate “shade” that will be recolored together (with a max of 8 rows). When setting up colors.gml, you need to define the “main color” for each row.

 

You want to choose the color closest to the average of each shade, while also avoiding extremely light or extremely dark colors.

 

Using set_color_profile_slot( color_slot, shade_slot, R, G, B ) initialize color slot 0 with the RGB values of each main color:

// DEFAULT COLOR (R, G, B)
set_color_profile_slot( 0, 0, 51, 102, 52 ); // Dark greens
set_color_profile_slot( 0, 1, 178, 205, 152 ); // Light greens
set_color_profile_slot( 0, 2, 136, 104, 93 ); // Browns

Now you will need to define the “range” for each shade so the shader knows what colors are related to the main colors. Any color whose HSV values are all within the defined range relative to the main color will be considered “related colors”. For example, the HSV values of the top row of the example colors are:

(140°, 40%, 58%) (121°, 50%, 40%) (122°, 50%, 25%)

Relative to the main color, the largest hue difference is 19 (140 – 121), so we want to set the hue range to 20 (always add 1 to account for rounding). Then the saturation range should be 11 (50 – 40 + 1) and the value range should be 19 (58 – 40 + 1). So you would have this line in colors.gml:

set_color_profile_slot_range( 0, 20, 11, 19 );

Note: hue is a looping value, so the difference between a hue of 350° and a hue of 10° is only 20°, not 340°.

Repeat this process for each row and you’ll be ready to start creating alternate color palettes by calling set_color_profile_slot for slots 1 through 5 like this:

// Blue Color
set_color_profile_slot( 1, 0, 65, 111, 153 );
set_color_profile_slot( 1, 1, 169, 196, 222 );
set_color_profile_slot( 1, 2, 171, 182, 185 );
 
// Red Color
set_color_profile_slot( 2, 0, 146, 44, 44 );
set_color_profile_slot( 2, 1, 216, 175, 175 );
set_color_profile_slot( 2, 2, 94, 82, 79 );
 
// etc.