How do you determine which theme you are on when ZSH_THEME="random"

Naruto Sempai picture Naruto Sempai · Jul 27, 2015 · Viewed 9k times · Source

I found a theme I like but only after executing a program on the command line with a lot of output, so I don't know the name of the current theme!

Here is the relevant part of my .zshrc:

# Set name of the theme to load.
...
ZSH_THEME="random"

Is there a way to determine which theme I am on?

Answer

4ae1e1 picture 4ae1e1 · Jul 27, 2015

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

if [ "$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

print $RANDOM_THEME