Gangmax Blog

The current theme of 'oh-my-zsh'

In “on-my-zsh”, you can set “ZSH_THEME=”random”” in the “.zshrc” file. By doing so, the theme of the terminal will be changed each time when you open a terminal window.

One question is that, how to know what the current theme is? The answer is from here.

According to oh-my-zsh.sh L81-87:

1
2
3
4
5
6
7
f [ "$ZSH_THEME" = "random" ]; then
themes=($ZSH/themes/*zsh-theme)
N=${#themes[@]}
((N=(RANDOM%N)+1))
RANDOM_THEME=${themes[$N]}
source "$RANDOM_THEME"
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."

Therefore you should be able to print the path to the random theme with:

1
print $RANDOM_THEME

Comments