In macOS's Terminal app, the default theme (Basic) adapts dynamically to system settings, but as soon as I customize the Basic theme from the preferences menu, it stops adapting. Is there a way to manually configure Terminal to look at the system mode and choose a theme appropriately?
Is there a way to change macOS Terminal's theme/profile based on the system dark/light mode?
14.7k Views Asked by Parth Shimpi At
3
There are 3 best solutions below
0

For those who end up here looking for a way to change the terminal theme if your system is in Dark Mode, I did find this solution dark-mode-macos-safari-iterm-vim, you can default to a light theme and this will override with a dark theme when you launch Terminal in dark mode.
# Switch to Solarized Dark if we are currently in dark mode
if [[ "$(uname -s)" == "Darwin" ]]; then
val=$(defaults read -g AppleInterfaceStyle 2>/dev/null)
if [[ $val == "Dark" ]]; then
osascript -e 'tell application "Terminal"
set current settings of tabs of windows to settings set "Solarized Dark" # Theme name
end tell'
else
fi
fi
macOS's Terminal app doesn't have a setting to dynamically pick a theme. However, when customizing a theme (or creating your own), you can pick colors that dynamically adapt to the OS.
When choosing colors, go to the third tab and, from the drop-down at the top, choose Developer. These colors will adapt automatically to the current system theme.
⚠️ Caveat: If you modify these colors in any way (even only their opacity), they will stop adapting to the system theme.