Zenburn Theme for the terminal

Jan 23, 2019 ·

So today I glanced down to my i3 status bar, and thought man those colours are fugly. By default, these are white, fully saturated neon green and red on black:

‘5 minutes is enough to configure the colors for this, right?’

Some research and 2 hours down the rabbit-hole later, and everything from my text editor to the status bar is Zenburn-themed.

Zenburn is a low-contrast theme meant to ensure your eyes do not fall off when you’re having that mexican-standoff with whatever project you happen to be Vimming.

But most of us spend a lot of time in text editors and on the command line, and Zenburn is a theme for Vim only. This useful and beautiful theme does not have an .Xresources file listed on the official page of Zenburn things.

As I’m a fan of cohesion, this now exists, this blog post will explain how.

First, I extracted the colors from the original zenburn.vim using simple regex:

matches = re.findall(r'#(?:[0-9a-fA-F]{3}){1,2}', line)

I then used yattag, a Python library for creating HTML, and displayed all the unique colors from the file. It looks like this:

#c0bed1
#bc6c4c
#80d4aa
#dfdfbf
#4f4f4f
#2b2b2b
#bc8cbc
#d0d0a0
#e89393
#82a282
#304a3d
#444444
#8f8f8f
#2e3330
#242424
#f8f893
#41363c
#88b090
#f0f0c0
#dccdcc
#121212
#313c36
#efef8f
#bc6c9c
#2f2f2f
#464646
#353535
#ecbcbc
#71d3b4
#dcdccc
#7cac7c
#222222
#93b3a3
#5b605e
#dfdfdf
#000d18
#0f0f0f
#353a37
#ffd7a7
#dc8c6c
#dca3a3
#383838
#1f1f1f
#b2b2a0
#b6bf98
#e3ceab
#688060
#709080
#cc9393
#434343
#dfaf8f
#3a3a39
#acd0b3
#2c2e2e
#bca3a3
#efefaf
#545a4f
#343434
#2c302d
#000000
#a0afa0
#313633
#6c6c9c
#8c8cbc
#9fafaf
#efefef
#d0d0b8
#9ccc9c
#8faf9f
#3f3f3f
#ffffe0
#ffffff
#284f28
#664040
#ccd990
#c3bf9f
#dfcfaf
#e37170
#1c1c1b
#efdcbc
#ccccbc
#233323
#333333
#f18c96
#404040
#161616
#262626
#f0f0b0
#cfcfaf
#f0dfaf
#385f38
#040404
#9ece9e
#cbecd0
#434443
#dfe4cf
#3f4040
#ccdc90
#3d3535
#101010
#f0efd0
#ffcfaf
#7f9f7f
#2e2e2e
#181818
#9f9f9f
#8cd0d3
#cfbfaf

To get the colors to make a bit of sense, some sorting was in order. I spent some time reading this excellent article about why sorting colours is a pain. I then did some quick RGB to HSV conversion and sorting, and voilà:

#000000
#040404
#0f0f0f
#101010
#121212
#161616
#181818
#1f1f1f
#222222
#242424
#262626
#2b2b2b
#2e2e2e
#2f2f2f
#333333
#343434
#353535
#383838
#3f3f3f
#404040
#434343
#444444
#464646
#4f4f4f
#8f8f8f
#9f9f9f
#dfdfdf
#efefef
#ffffff
#3d3535
#bca3a3
#ecbcbc
#dca3a3
#cc9393
#e89393
#664040
#e37170
#dccdcc
#bc6c4c
#dc8c6c
#ffcfaf
#dfaf8f
#cfbfaf
#ffd7a7
#e3ceab
#efdcbc
#dfcfaf
#f0dfaf
#c3bf9f
#f0efd0
#3a3a39
#1c1c1b
#dcdccc
#ccccbc
#b2b2a0
#d0d0b8
#ffffe0
#dfdfbf
#cfcfaf
#f0f0c0
#d0d0a0
#f0f0b0
#efefaf
#efef8f
#f8f893
#ccd990
#ccdc90
#b6bf98
#dfe4cf
#545a4f
#688060
#434443
#a0afa0
#82a282
#7f9f7f
#9ece9e
#9ccc9c
#7cac7c
#233323
#385f38
#284f28
#cbecd0
#acd0b3
#88b090
#2c302d
#2e3330
#353a37
#313633
#313c36
#93b3a3
#8faf9f
#709080
#304a3d
#80d4aa
#5b605e
#71d3b4
#3f4040
#2c2e2e
#9fafaf
#8cd0d3
#000d18
#8c8cbc
#6c6c9c
#c0bed1
#bc8cbc
#bc6c9c
#41363c
#f18c96

This looks better and one can easily see what colors there are.

The next stop was terminal.sexy, which is an amazing terminal theme tool which allows you to vizualize and export your work easily. Here’s our theme:

And here’s how it looks in the terminal:

The i3 window colors, borders and status bar have now also been changed to match:

And for completeness, here’s a Firefox theme to match, because we can:

Starting the new year ready to sysadmin for hours on end in an ill-lit room, happy hacking!