Colorschemes

← Back to main site

Published on: Saturday 03 May 2025 10:15:40 AM IST

My Obsession

I have an obsession with changing my colorscheme every single day. Reason? I can't seem to find a good one, and when I do, I find an even better one. sigh. I've tried many colorschemes, and some ways to "hot swap" my themes, and I'm working on something that might end this problem forever ;)

Symlinks, Includes, and Simple Variables

This problem can be easily fixed: just have a whole bunch of configurations, each with different colorschemes. But how? It's simple. Since I use dwl (dwm for Wayland), everything is configured in C. And C (and other languages) has the handy-dandy way to "include" other files — that's source in Bash, require in Lua (I think — those examples were randomly selected).

What I did was create a themes directory in my build of dwl, with 6 cool colorschemes:

Then, I simply include the one that I want in the config.h file like so:

#include "themes/dracula.h"

As for other programs, it's simple. There are only two other programs that need color theme-ing: WezTerm and Dunst.

For WezTerm, you use the config.color_scheme setting to choose your scheme. Problem? The scheme names are complicated. Since it's Lua, you can just do this using variables:

-- Colorscheme
local color = "dracula"

-- Map of color names to color scheme strings
local color_schemes = {
  dracula    = 'Dracula (Official)',
  catppuccin = 'Catppuccin Mocha',
  gruvbox    = 'Gruvbox dark, hard (base16)',
  monokai    = 'Monokai (base16)',
  nord       = 'Nord (base16)',
  solarized  = 'Solarized (dark) (terminal.sexy)',
}

-- Apply the color scheme based on the value of `color`
config.color_scheme = color_schemes[color]

As for Dunst, I used symlinks. Basically, in ~/.config/dunst, I have files like dunstgruvbox, dunstsolarized, and dunstdracula. Then, for example, I symlink dunstdracula to dunstrc (which is used by Dunst).

Wallpapers

One problem though — when I change colorschemes, I have to manually change the wallpaper directory in my wallpaper script. But it's a script — you can do anything. So now it reads .wezterm.lua to see the current scheme and changes the wallpaper directory accordingly.

Conclusion

I will write a script to automate all of this, so that I never worry about colorschemes again.