On macOS, not all tools automatically adjust to toggling light and dark mode. iTerm2, tmux, and Vim, for instance, need to be told what to do.
Here's a launchd
snippet and a shell script.
Make sure /bin/sh
(the shell that will run the script) has Full Disk Access.
(In the file picker dialog, Command-Shift-G will let you type a path.)
$ make install
$ launchctl load ~/Library/LaunchAgents/com.schmonz.lightdark.plist
I don't much care for this arrangement, but it seems to work. (This repo doesn't provide anything it needs. If you only care about iTerm2, don't clone this, just follow the below steps.)
- Download https://iterm2.com/python-api/_downloads/5d351349bb5297f76f9d4a63f2ee997b/theme.its
- iTerm2 -> Settings -> General -> Magic: Enable Python API
- Scripts -> Manage -> Install Python Runtime
- Scripts -> Manage -> Import... -> your downloaded script -> AutoLaunch
- Scripts -> Manage -> Reveal Scripts in Finder
- Scripts folder -> AutoLaunch -> theme -> theme -> edit theme.py to specify your preferred themes
XXX
- Use
colorscheme solarized
(or another scheme with light and dark variants) - Add
autocmd VimResume * call echoraw(&t_RB)
(and another forFocusGained
) - When in dark mode, tolerate
vim
startup flickering as it defaults tobackground=light
and then quickly adjusts - On any mode switch, tolerate
vim
not changing colors until you focus on it
- Open some terminals and editor sessions.
- In System Settings -> Appearance, manually toggle between light and dark mode.
- Observe how (and when) terminals and editor sessions notice the change.
- Start some new terminals and editor sessions, too.