High contrast vs. muted color themes
Are high-contrast themes like Modus “better” than the more muted vibes like Catppuccin, Tokyo Night, or my personal favorite, Gruvbox?
I assumed there was a correct answer to this question, but of course reality is more complicated. The benefits of high-contrast themes are perhaps obvious. You can more easily see the letter shapes, especially when there’s a lot of ambient light or glare. That’s when I tend to reach for something like Modus.
On the other hand, high-contrast themes can be fatiguing because you’re staring at brighter lights on the screen. They can also cause halation, where bright text looks like it’s glowing or bleeding into the surrounding background. Apparently this is even more common for people with astigmatism.
Muted themes address those issues by reducing glare and brightness-driven fatigue. But if the contrast drops too low, or there’s too much ambient light bouncing off the screen, that’s a different sort of strain.
I suppose the question comes down to what I’ll call the “net contrast” of the theme once you factor in your environment’s lighting. (Gemini referred to this as contrast disparity, but I’m not sure that’s correct.)
My takeaways
Given the variables, it seems smart to be able to switch themes depending on the conditions. In my case, I want to mostly live in a more muted theme like Gruvbox and then switch to a higher-contrast theme when it’s bright around me.
GUI text editors
Switching themes is trivial in editors like VSCode and Jet.
They have shortcuts like Cmd-K Cmd-T to pop up a quick switcher, and the change is saved in your config.
Boom.
Done.
Neovim
You can quick-switch themes in Neovim with the command:
:colorscheme $name
And you can tab-complete the names. Pretty good.
Neovim will also figure out whether your system is light or dark mode and follow suit.
It doesn’t actually ask your OS, but rather your terminal emulator via an ANSI escape sequence (OSC 11, apparently).
Modern terminals like Ghostty, which I use, know how to respond to Neovim’s “question” with an RGB value, which Neovim then uses to determine whether it should set the background to light or dark.
And since Ghostty restyles itself because on the OS setting, I can use my macOS-level light/dark mode to control the OS, my terminal, and Neovim.
Pretty cool!
You can also force light or dark palettes in Neovim with :set bg=light and :set bg=dark.
You do need to install the themes first. In a simple case, this can look like:
vim.pack.add({
-- ...
"https://github.com/folke/tokyonight.nvim",
})
vim.cmd[[colorscheme tokyonight]]
If you’re getting wonky coloring, Neovim might not be detecting 24-bit color properly. You could try enabling it explicitly in your config to see if it helps:
vim.o.termguicolors = true
See :h 'termguicolors'.
Ghostty (terminal emulator)
Ghostty will on-the-fly switch between light and dark mode as long as you have them configured properly. My config currently looks like this:
theme = dark:Gruvbox Material,light:Gruvbox Material Light
Ghostty provides this handy command which pops up a searchable picker of its pantload of themes for perusal:
ghostty +list-themes
See the Ghostty docs.
A note on tmux
I noticed that my Neovim colors were subtly different when inside tmux.
I fixed it by adding these lines to ~/.tmux.conf:
# Tell tmux to use 24-bit true color mappings
set -g default-terminal "tmux-256color"
set -as terminal-features ",xterm-256color:RGB"
And then restarting tmux with tmux kill-server.
Apparently merely reloading the config file isn’t enough.
Thoughts on my blog’s color theme
While writing this post, I began appreciating the muted color schemes more deliberately and decided my blog’s dark-mode styling was too high contrast for my taste. I gave it a makeover with the Gruvbox palette. I’m not a designer; If you hate it or see anything broken, please email me!
- ← Previous
Neovim rabbit hole