Write a program that, for any \$n\$, generates a triangle made of hexagons as shown, \$2^n\$ to a side. The colors are to be determined as follows.

We may give the triangle barycentric coordinates so that every hexagon is described by a triple \$(x,y,z)\$ with \$x+y+z=2^n-1\$. (The three corners will be \$(2^n-1,0,0)\$, \$(0,2^n-1,0)\$, and \$(0,0,2^n-1)\$.)

Let \$s_2(n)\$ refer to the number of 1s in the binary expansion of \$n\$. (This is sometimes called the _bitsum_ or the _popcount_ function.) If
$$s_2(x)+s_2(y)+s_3(z)\equiv n\pmod 2$$
then color the hexagon \$(x,y,z)\$ in a light color; otherwise, color it in a dark color. (These must be _colors_, not simply black and white.)

In your answer, I would appreciate seeing several example outputs, ideally including \$n=10\$.

This is my first post here, so I apologize if I misunderstand the rules somehow.
[![enter image description here][1]][1]


  [1]: https://i.sstatic.net/XGjBz.png