Pythagoras tree

If I remember correctly I got this figure from Leen Ammeraal's book Computer graphics for Java programmers. The Pythagoras tree was invented by a Dutch mathematics teacher. It is named after Pythagoras because each triple of touching squares encloses a right triangle, in a configuration traditionally used to represent the Pythagorean theorem.

What struck me about it, apart from its charm, was that Ammeraal never used any trig functions to draw it. So I thought it would pose a good challenge to the guys (and gals) at Rosetta Code.

The coloring is all mine though, and it's mighty purty, don't you agree?

View code on Github