Search code examples
zshzshrcoh-my-zsh

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


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?


Solution

  • 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