Protesilaos Stavrou
Philosopher. Polymath.

The Tempus themes

Prot's Dots For Debian - Book index

PRIOR NOTICE: all the scripts referenced herein are discussed in greater detail in the chapter about my local ~/bin.

All the colours you see are part of a project of mine called Tempus themes. These are colour schemes for Vim, terminal emulators and relevant tools. They consist of sixteen hues that correspond to the standard escape sequences for terminal colour definitions, in order from 0 to 15:

0-7: black, red, green, yellow, blue, magenta, cyan, white
8-15: bright {black, red, green, yellow, blue, magenta, cyan, white}

I have designed Tempus with the purpose of filling a perceived void in the theming space: that of accessible, functional, yet still presentable colour schemes. Tempus is designed to work well for as many users as possible, myself included.

In more technical terms, the Tempus themes are compliant at minimum with the Web Content Accessibility Guidelines (WCAG) level AA for colour contrast between foreground and background values. This stands for a relative luminance ratio of 4.5:1. That ratio is but a threshold as some members of the collection conform with the even higher standard of 7:1 (WCAG AAA).

Accessibility is about good design

To dispel any misconceptions, “accessibility” is not only useful for a subset of users. Accessibility is another way of describing thoughtful design. It benefits everyone. Being forced to read light grey on a white background or green text on a red backdrop is a major failure, indicating a lack of forethought and empathy with the user.

For us who spend considerable amounts of time interfacing with a computer, a good contrast ratio is essential to a subconsciously pleasant session (just as with good typography, as discussed in the chapter about fonts). Whether you read, write, code, your eyes will appreciate the improved legibility of text on the screen.

Try this: miscalibrate your monitor and/or your font configurations to make text look blurry and irritating to the eye. Work in that environment for a while to realise how much more painful it is. Eye strain is real, so do yourself a service by prioritising legibility over whimsy.

If you are used to inaccessible colour combinations, you may find Tempus themes a bit too sharp at first. Give it some time: your eyes will adapt to the improved presentation. I know from experience, as I used to work with inaccessible themes. In fact, I had developed an entire collection of them: Prot16. Those were not designed with accessibility and functionality in mind. Some might even “look better” than the Tempus themes, but none works better.

The Tempus themes collection

As of this writing (2019-04-25) the Tempus themes collection consists of the following items (WCAG rating in parentheses):

# Light themes
dawn       (AA)
day        (AA)
fugit      (AA)
past       (AA)
totus      (AAA)

# Dark themes
autumn     (AA)
classic    (AA)
dusk       (AA)
future     (AAA)
night      (AAA)
rift       (AA)
spring     (AA)
summer     (AA)
tempest    (AAA)
warp       (AA)
winter     (AA)

The one you get by default is Tempus Classic, which is a dark theme with warm hues.

Tempus and my dotfiles

With the exception of GTK widget and icon themes, Tempus is applied everywhere colours can be defined. Some notable examples are bspwm, vim, tmux, newsboat, neomutt, dunst, and my lemonbar script called melonpanel. Even GTK-based text editors are covered, such as gedit (GNOME default), pluma (MATE default), and gnome-builder.

A shell script is responsible for changing themes across all those applications. This is the own_script_update_environment_theme. You can run it directly from the terminal by adding a scheme’s name as its first argument. For example, to switch to the light theme day, you would do:

own_script_update_environment_theme day

A more convenient way is to use tempusmenu. This is a dmenu script that interfaces with the aforementioned command. It is bound to a hotkey sequence for your convenience. To invoke tempusmenu, type super + e; t (hold super and press e, then release super and just press t—this is a key chord chain, as discussed in the chapter about the basics of my BSPWM). A menu with all available items will appear. Either type your choice and press enter or use the arrow keys (or CLI/Emacs motions) and press enter.

My dotfiles are designed in such a way that the following changes will occur when performing a theme switch across the entire environment:

  • All running GTK applications, including Flatpaks, will convert to a light or dark variant of their current theme, depending on whether the selected Tempus theme is light or dark (assuming you followed the instructions in the chapter about installing core packages). So if you choose totus, for example, which is dark text on a light background, the GTK themes will also be light, and vice versa. This is courtesy of a running settings daemon. If you have followed the instructions in the chapters about installing Debian 10 ‘buster’ and adding the core packages, this is the mate-settings-daemon.
  • All running terminals will “live reload” their colours using escape sequences. Thanks to my own_script_update_running_terminals. Similarly, all running CLI programs like vim, newsboat, neomutt, less will gracefully adjust to the theme change.
  • My default terminal emulator, mate-terminal, will also write the new colour definitions to its database (also see the chapter about the default terminal).
  • The terminal multiplexer (tmux) will be instructed to reload its configurations in order to parse the new colours.
  • The top panel (melonpanel) will be re-run and display the new colours. Same with the notification daemon (dunst).
  • The wallpaper will change accordingly, if you have defined images at ~/Pictures/theme/{dark,light}.jpg.

All this happens in the blink of an eye. A desktop notification is sent once the process is done, informing you that everything went well and that the new theme is the one you selected. If you care about the specifics (or wish to contribute) you need to examine the script that does the heavy lifting: own_script_update_environment_theme.

In my opinion, this is a very neat feature. Having it bound to a key chord makes it even better. Now if you need any convincing of why you should ever be able to switch themes on the fly, try coding using a dark theme under direct sunlight…

Additional resources

The Tempus themes is a standalone project that happens to be integrated with my dotfiles. There are a number of git repos. The specialised ones are specific to the program they reference:

Also see the Tempus themes Generator: the tool that produces all these ports and the place where you could contribute new templates, code, ideas.

Known issues

The “live reloading” of all running instances of vim is contingent on tmux (see chapter on my Tmux+Vim combo). If you are running the text editor outside of the multiplexer’s control (e.g. a GUI), then the theme switch requires manual intervention. Either exit Vim and enter again or run :source ~/.vimrc. To fix this, I would need a program that can send key chords to running applications: this is possible within tmux, as can be seen in own_script_update_tmux_running_vim, but I have yet to find a standalone utility.

If you open a terminal while the theme switch is underway, it will likely retain its older colour scheme in the database, even if it might catch the step where terminals are live reloaded via escape sequences. In such a case the theme switch needs to be performed again or you must manually run own_script_mate_terminal_setup.