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.
Parameters
Section titled “Parameters”inputColor
Section titled “inputColor”Node <"vec4">
The input color (vec4 with alpha)
paletteTex
Section titled “paletteTex”Palette texture (horizontal strip)
paletteSize
Section titled “paletteSize”number
Number of colors in palette (max 16)
Returns
Section titled “Returns”Node <"vec4">
Color snapped to nearest palette color
Example
Section titled “Example”// Find nearest color in 8-color palettepalettizeNearest(color, palette8, 8)