I made the triangle with my recursive graphics language Ratsub, which was designed for recursively subdividing, colouring, extending shapes, using very short programs. There are many examples of what’s possible with Ratsub in the 3 PDFs in that repo.
This ratsub program (reptri.sdv) draws your triangle:
no edges pgon 3 80 -30 def t 3 y :102 red y :021 blue y :210 yellow def y 3 p3..5 p0.. .5 p1..0 rr :524 y :314 y :345 def rr 3 p3..5 p0.. .5 p1..0 draw :524 y :305 rr :314 rr :534
The initial triangle vertices are point 0,1,2 anticlockwise from lower right. The initial shape t calls shape y for each colour, with red on top. The shape y makes new points p3 halfway between p0 and p1, p4 halfway between p1 and p2, and p5, halfway between p2 and p0, then calls rr with the triangle made of points 5, 2 and 4, then calls y with the triangle made by points 3, 1 and 4 etc. The 3 points passed to each triangle become that triangle’s point 0, 1 and 2.
The commmand “ratsub reptri 1 12” produces 12 images, the first stopping at 1 level of recursion/stack depth, the second at level 2 etc :
Most of the drawing in the higher levels is done by the “draw” command in the rr shape, which immediately draws its triangle between points 5, 2 and 4. Omitting the “no edges” line, you can see more clearly the triangles it draws:
My version can be thought of as shrinking your triangle down at its lower left vertex, to 1/4 the initial side length, then turning it over and over across its edges to fill the original large triangle.
The ratsub program for it just divides the initial triangle into 4 triangles twice, then (i.e. at level 2 – the “=2” means “at level 2 do this instead:”) makes your triangle in each. The pic below is level 14.
no edges pgon 3 200 -30 def s 3 p3..5 p0.. .5 p1..0 s :314 s :350 s :254 s :354 =2 y :102 red y :021 blue y :210 yellow def y 3 p3..5 p0.. .5 p1..0 rr :524 y :314 y :345 def rr 3 p3..5 p0.. .5 p1..0 draw :524 y :305 rr :314 rr :534
How did I write that first program? I don’t remember exactly! A lot of trial and error. First I tried drawing all colours together, then gave up and just worked out how to do the red. Here’s the page from my notebook. A sketch or two is an essential part of writing every ratsub program!