[Math] How should I assign RGB colors to points in the Mandelbrot Set

fractals

I decided to learn about the Canvas object in javascript by implementing a display of the Mandelbrot Set.

I am mimicking the Mandelbrot psuedocode found on wikipedia. The thrust of it is that the number of iterations it takes for a point to diverge is proportional to the color that is assigned to that point. However, in javascript, colors are represented in three dimensions, which one dimension (with values from 0 to 255) for the red, blue, and green channels. Obviously when I assign the same values to each channel, I get a boring image in shades of grey.

I was wondering, how would one map this "number of iterations to diverge" into the RGB space and make it look more interesting?

Best Answer

generated image

As Chris Phan pointed out in the comments, I used the HSL colour space and it looked great.

Related Question