mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Add ability to switch between 'random' themes and 'favorite' themes
- Refactored code for getting a random theme into a function
- Setting your theme to 'favorites' will now pick a random theme from your
favorites and setting theme to 'random' will pick a random theme from ALL
available themes
This commit is contained in:
parent
a3c24f6b78
commit
45dc772c7c
2 changed files with 17 additions and 14 deletions
|
|
@ -78,3 +78,13 @@ function unlike_theme() {
|
|||
echo "$theme_name isn't a favorite"
|
||||
fi
|
||||
}
|
||||
|
||||
function load_random_theme() {
|
||||
themes=($*)
|
||||
N=${#themes[@]}
|
||||
((N=(RANDOM%N)+1))
|
||||
RANDOM_THEME=${themes[$N]}
|
||||
source "$RANDOM_THEME"
|
||||
echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
|
||||
export RANDOM_THEME
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue