Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 610
Naruto Sempai Avatar asked Jul 26 '15 23:07

Naruto Sempai


People also ask

How do I know what zsh theme I have?

You can use prompt -c which will print the current theme.

How do I change the theme in Ohmyzsh?

You can browse all the “Oh My ZSH” Themes here. To change the Theme, simply change the ZSH_THEME value in ~/. zshrc file from robbyrussell to Avit.

What is the point of oh my zsh?

It is the most popular framework for managing Zsh configuration, plugins, and themes. It will help you transition from using your current shell to Zsh in the easiest way possible. Although Oh My Zsh can do many other things, it is the most famous for its ability to easily manage a ton of themes and plugins.


2 Answers

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 
like image 129
4ae1e1 Avatar answered Sep 21 '22 12:09

4ae1e1


As it was requested to its developers team, a new command is added to support this functionality:

just use:

echo $ZSH_THEME 

the response will be the current theme which is using by user.

like image 37
Majid Roustaei Avatar answered Sep 23 '22 12:09

Majid Roustaei