Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

How to Generate the Sierpinski Triangle [8/10]

8. Coloring by RGB Triplets

The drawing of the Sierpinski triangle is now in gold color on a blue background, which looks very different than the image produced by the previous page.
[Run the program]

ZedLX allows colors to be given by RGB triplets inside the square brackets. It is important to note that the three RGB color components must be given as linear values in range of 0 to 100, as the data type 'color' in ZedLX is defined that way. The colors are then converted to the sRGB color space as they are displayed.

The number of levels of Sierpinski triangle is still 7, therefore it has not been increased. There is not much point in increasing the level further, as the drawing is quickly approaching the maximum resolution of the output image.
[Run the program]

On the next page, we examine the level of detail of the Sierpinski triangle.

Loading...