Skip to content

palettizeNearest

palettizeNearest(inputColor, paletteTex, paletteSize): Node <"vec4">

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

Find nearest color in palette by comparing RGB distance. More accurate than luminance-based but more expensive.

Node <"vec4">

The input color (vec4 with alpha)

Texture 

Palette texture (horizontal strip)

number

Number of colors in palette (max 16)

Node <"vec4">

Color snapped to nearest palette color

// Find nearest color in 8-color palette
palettizeNearest(color, palette8, 8)