Number of iterations before the point escaped (0 to maxIterations)
Maximum iterations used in the fractal calculation
Name of the color palette to use (default: 'rainbow')
RGB color as [red, green, blue] array with values 0-255
import { getColor } from './colors.js';
// Points in the set are black
const setColor = getColor(1000, 1000, 'rainbow'); // [0, 0, 0]
// Points outside get colored by iteration count
const escapeColor = getColor(50, 1000, 'fire'); // Warm color
const quickEscape = getColor(5, 1000, 'cool'); // Cool color
// Different palettes for same iteration
const rainbow = getColor(100, 500, 'rainbow');
const fire = getColor(100, 500, 'fire');
const ocean = getColor(100, 500, 'ocean');
Maps iteration count to RGB color using the specified palette
This is the primary function for converting Mandelbrot iteration results into visual colors. It handles both set membership (black) and iteration-based coloring with smooth palette transitions.