Friday 28th of October 2022

In my previous post I mentioned how I’d added the ability for the user to choose themes to Velum. In its original guise, this was a select box with an auto-generated list of themes, each one derived from a CSS file in the themes directory. It was quite a powerful system, in that each CSS file had complete control over the look of the page, but it had a big downside: it was a maintenance nightmare when I wanted to have three similar-looking theme, a light, dark, and ‘darkroom’.

The idea was they’d all have the same layout, but differ in the colours they used. However, any layout change to one file meant a corresponding change to the other two, and it was very easy to forget to do this, or make a mistake doing so.

The themes were supposed to be quite basic, but it turns out I actually preferred them to the old ‘Topo’ theme (and the newer ‘Pastel Night’ one), and I also encountered a cool idea on another developer blog: a simple ‘lightbulb’ button that switched the blog from light to dark.

After a bit of tweaking, I’ve now settled on a slightly expanded version of the light/dark idea, in that I’ve also included the aforementioned ‘darkroom’ mode: it’s like dark mode, but really dark. The text is red, the links are dimmed, even images are dimmed until you click/tap on them. It’s all designed around reading in really dark conditions, to help preserve your night vision.