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?
-
You mention a preference menu; don't confuse the *terminal*'s color scheme with anything provided by the shell. – chepner Dec 03 '20 at 21:50
-
What is the difference and what is the way to get the desired result? – Parth Shimpi Dec 03 '20 at 22:20
-
The difference is, shells don't know anything about colors; they only output escape sequences that terminals *interpret* as requests display characters in a particular color, rather than displaying them directly. – chepner Dec 03 '20 at 22:21
3 Answers
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.

- 5,250
- 1
- 18
- 27
-
Per the original question this does not select a them based on the Dark/Light mode of the system. This allows you to make a theme based on a color palette that changes with Dark.Light mode. – Jimmy Bosse Feb 05 '21 at 03:34
-
3@JimmyBosse My answer solves the OP’s problem as posted: “ On ZSH the default theme (Basic) adapts dynamically to system settings, but as soon as I customise the Basic theme from the preferences menu it stops adapting.” – Marlon Richert Feb 05 '21 at 06:24
-
I guess their question had two parts and we both saw it from different angles. My brain focused on the part, “Is there a way to manually configure ZSH to look at system mode and choose theme appropriately,” because that’s the question I had that landed me here. I tried to switch my downvote to an upvote but SO won’t let me. – Jimmy Bosse Feb 06 '21 at 18:08
-
1@JimmyBosse I edited the text. You should be able to change your vote now. – Marlon Richert Mar 11 '21 at 15:36
-
The dynamic colours stop working as soon as you add transparency it seems. – Brad Jun 16 '22 at 09:23
-
-
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

- 2,617
- 1
- 23
- 46

- 1,344
- 1
- 12
- 24
i used jimmy's answer to create auto-terminal-profile

- 1,409
- 15
- 10
-
1Works. Initially, nothing; because it takes just a little setup. After I ran most of the commands and MacOS prompted me to allow Terminal to make changes, then the app started working automatically (as in the visual). Thanks @ptrkcsk. – Wesley B Oct 12 '22 at 16:08