Color
Introduction
The Color value can be used to set or modify the effective color of an object. The color value is combined with the Color Operation and an object's Source File or Font settings to produce a final color.
Example: Setting Color
Most objects in Gum have a Color (or similar) property which can be set directly in the editor. For example, Text instances have a Color which directly controls their effective color.

Color and Shapes
Shapes support multiple color values. Which value applies depends on a number of settings.
Stroke Color
By default shapes render their outline. The Stroke Color variable controls their outline color.

Stroke Color also applies to Rectangles.

Fill Color
Circles and Rectangles can set an independent Fill Color along Stroke Color. First, Is Filled must be checked. Once a shape is filled, its Fill Color can be set.

Color Operations
Sprites and NineSlices can change the way their Color value is applied by changing Color Operation.
Modulate
The Modulate Color Operation is also often referred to as multiply. This is the default value, and it multiplies color the sprite that is being drawn by the color value.
Modulate is the default Color Operation value. When paired with the default value of (255, 255, 255) - pure white - Modulate does not modify the color of a sprite.

Any color other than white darkens the Sprite. A value of pure black results in all colors (red, green, blue) being multiplied by 0, which creates a black silhouette.

The math for multiply is that each of the three color components is normalized, which means a value of 0 to 255 is adjusted to a 0 to 1 range. Therefore, values of 128 become a value of (nearly) 0.5. These normalized values are multiplied against each channel in the source image to produce a final result.
Multiplying by a color which has uneven red, green, and blue values can darken and tint.

Add
The Add Color Operation can be used to add color values to the source image. Add can be used to brighten color values.
An Add value of 0, 0, 0 does not modify the original sprite.

Any other color besides black brightens the Sprite. A value of white creates a white silhouette, resulting in all color values displaying their max 255.

Other values can be used to tint and brighten the argument sprite.

Silhouette (Color + Texture Alpha)
The Silhouette Color Operation uses the Sprite's Color value while keeping the Source File's opacity. This Color Operation is used to create colored silhouettes.
When using Silhouette, color values overwrite the source texture.

Last updated
Was this helpful?

