Generating pride-themed Norse valknuts with Python 🌈
You might remember a couple of months back, I was playing with alternative coordinate systems in SVG. There are some shapes which are easier to define with triangular coordinates than regular (x,y)-coordinates, and I created some Python functions to let me switch between the two coordinate systems.
One shape that’s much easier to define in triangular coordinates is the valknut, a symbol made from three interlocked triangles that appears on a lot of objects from ancient Germanic cultures:
There are two variables here: the width of the bars, and the width of the gaps. If you start at the lower left-hand corner, you can use triangular coordinates to define every point on this shape in terms of those two variables. This is what I wanted to draw using SVG.
So why was I trying to draw a valknut?
The valknut is also used by some white nationalist groups, which prompted this tweet by @KlezmerGryphon. “Hey, Nazis, I got a message for ya from Odin”, along with a picture of a valknut coloured with the stripes of several pride flags. I liked their design, and I wanted to try reproducing it as an SVG.
The original post was some of my early research into triangular coordinates, but it wasn’t until recently that I came back to the rainbow valknuts.
About two weeks ago, I got the code working, and created a small Flask app that generates valknuts made from different pride flags. This is what it looks like:
It picks a random selection of three flags every time you reload the page, or you can get a permalink to save that particular image. The list of flags comes from the QueerJS website.
If you’re interested, you can play with the app at https://rainbow-valknuts.glitch.me/, or browse the source code on GitHub.
This was a fun little project to work on, and I’m hoping to do more fun things like this in 2020. I’m especially enjoying Glitch as a place to host these one-off, whimsical bits of code – I’ll hopefully write more about it soon.