Add blacklist variable for random theme
Co-authored-by: Fran Garcia <fran.miranda@gmail.com>
Diff
1diff --git a/themes/random.zsh-theme b/themes/random.zsh-theme
2index 92d2a68474e52c488b768c9c7c486d4eece180ac..43f6cbb60b5e9b4db46aec9cba2e5c0bb03ce2d2 100644
3--- a/themes/random.zsh-theme
4+++ b/themes/random.zsh-theme
5@@ -5,19 +5,23 @@ if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = array && ${#ZSH_THEME_RANDOM_CANDIDA
6 # Use ZSH_THEME_RANDOM_CANDIDATES if properly defined
7 themes=($ZSH_THEME_RANDOM_CANDIDATES)
8 else
9- # Look for themes in $ZSH_CUSTOM and $ZSH and add only the theme name (:t)
10+ # Look for themes in $ZSH_CUSTOM and $ZSH and add only the theme name
11 themes=(
12 "$ZSH_CUSTOM"/*.zsh-theme(N:t:r)
13 "$ZSH_CUSTOM"/themes/*.zsh-theme(N:t:r)
14 "$ZSH"/themes/*.zsh-theme(N:t:r)
15 )
16+ # Remove blacklisted themes from the list
17+ for theme in ${ZSH_THEME_RANDOM_BLACKLIST[@]}; do
18+ themes=("${(@)themes:#$theme}")
19+ done
20 fi
2122 # Choose a theme out of the pool of candidates
23 N=${#themes[@]}
24 (( N = (RANDOM%N) + 1 ))
25 RANDOM_THEME="${themes[$N]}"
26-unset N themes
27+unset N themes theme
2829 # Source theme
30 if [[ -f "$ZSH_CUSTOM/$RANDOM_THEME.zsh-theme" ]]; then