Half past orange: A rainbow color clock

This week’s post is a little less science and a little more design - it’s actually a side project I’ve been working on to practice R and Python.

I thought it would be fun to find an algorithm to define “what Eleanor thinks is a pretty color.” I think generative design is pretty cool, so the idea was to write something I could use to automatically pick colors for maps or vector patterns or graphs.

To define “pretty colors” I used R to fit adaptively smoothed splines to 264 colors I picked by hand. So that was a total of 792 data points - 264 for each RGB channel. (I thought about using CIELAB, but it was less intuitive for me to define “pretty colors” in LAB space).

These interlocking graphs describe every color I like, and none I don’t like: I’m still a beginner in R and Python, so this actually took a surprising amount of time. But I ended up learning a lot about different color spaces and the biology of human color vision.

For example, I wanted to include a hue variable like the “H” in HSV. But HSV doesn’t account for the fact that human eyes aren’t equally sensitive across the color spectrum. So I manually adjusted my own scale to look more consistent.

A linear HSV (HSV1) has too much green and blue. A HSV sine wave (HSV2) is better, but still doesn’t have much yellow. For mine I got rid of the ugly neon colors and increased the amount of orange and yellow: To test out the finished algorithm I made a rainbow color clock. The clock cycles through the color wheel every 12 hours using only colors I like. So that means no neon colors, muddy yellows, extremely bright pastels, or artificial-looking colors like 100% blue.

The clock also changes brightness every hour so that the half-hour mark is the brightest and the hour-mark is the darkest. I wanted fairly basic rules so you could actually use the color to tell time.

The color names are pulled from Chirag Mehta’s Name that Color Javascript library. It’s an awesome open source tool that finds the closest named color in a huge database of color names. I think my favorite names are Mantis green and Meteorite purple.

This is what the rainbow clock looks like in its original equation form. Each of the RGB channels oscillates up and down once an hour. The finished rainbow color clock lives here as a responsive web page. I think I’ll eventually laser-cut a plywood frame for my old phone so I can have a nice wall-mounted version in my office at work.