Skip to content

palettize

palettize(inputColor, paletteTex, strength): Node<"vec4">

Defined in: packages/nodes/src/retro/palettize.ts:31

Map colors to nearest match in a palette texture. Palette should be a 1D horizontal texture (Nx1 pixels).

This function samples the palette by computing the luminance of the input color and using it to index into the palette texture.

Parameters

inputColor

Node<"vec4">

The input color (vec4 with alpha)

paletteTex

Texture

Palette texture (horizontal strip)

strength

FloatInput = 1

Effect strength (0 = original, 1 = fully palettized)

Returns

Node<"vec4">

Color snapped to palette

Examples

// Apply GameBoy palette
palettize(color, gbPaletteTexture)
// Partial palette effect
palettize(color, retroPalette, 0.5)