Skip to content

colorize

const colorize: EffectDefinition<ColorizeHandle, ColorizeOptions>

Defined in: effects/src/colorize.ts:194

Luminance-to-colour recolour — preserves a sprite’s value structure (the black/white relationship) while replacing the hue. Pixi’s built-in sprite.tint MULTIPLIES the source by a tint colour, which turns saturated source pixels into mud (a blue mushroom × yellow tint reads as an olive blob, not a yellow mushroom). colorize outputs mix(sourceRGB, tintColor * L, strength) instead, where L is the standard Rec. 601 luminance — black stays black, white reaches the target colour, midtones blend proportionally. Source alpha is preserved unchanged. Reach for this when pixel-art recolours need to stand out against the existing palette.

setIntensity cross-fades back to the source at 0, so fadeIn ramps the recolour in cleanly. setColor / setStrength tune the look at runtime.