summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2020-02-19 19:53:37 +0100
committerMarc Cornellà <marc.cornella@live.com>2020-02-19 20:00:22 +0100
commit3d4890dcc07478e7129de1e79afedafd3f08ffbc (patch)
tree66b959555d5227f0f9889c5347eb513a266bce22 /themes
parentf4b4a446aca37987bc2612d6115d156417628364 (diff)
downloadzsh-3d4890dcc07478e7129de1e79afedafd3f08ffbc.tar.gz
zsh-3d4890dcc07478e7129de1e79afedafd3f08ffbc.tar.bz2
zsh-3d4890dcc07478e7129de1e79afedafd3f08ffbc.zip
Add blacklist variable for random theme
Co-authored-by: Fran Garcia <fran.miranda@gmail.com>
Diffstat (limited to 'themes')
-rw-r--r--themes/random.zsh-theme8
1 files changed, 6 insertions, 2 deletions
diff --git a/themes/random.zsh-theme b/themes/random.zsh-theme
index 92d2a6847..43f6cbb60 100644
--- a/themes/random.zsh-theme
+++ b/themes/random.zsh-theme
@@ -5,19 +5,23 @@ if [[ "${(t)ZSH_THEME_RANDOM_CANDIDATES}" = array && ${#ZSH_THEME_RANDOM_CANDIDA
# Use ZSH_THEME_RANDOM_CANDIDATES if properly defined
themes=($ZSH_THEME_RANDOM_CANDIDATES)
else
- # Look for themes in $ZSH_CUSTOM and $ZSH and add only the theme name (:t)
+ # Look for themes in $ZSH_CUSTOM and $ZSH and add only the theme name
themes=(
"$ZSH_CUSTOM"/*.zsh-theme(N:t:r)
"$ZSH_CUSTOM"/themes/*.zsh-theme(N:t:r)
"$ZSH"/themes/*.zsh-theme(N:t:r)
)
+ # Remove blacklisted themes from the list
+ for theme in ${ZSH_THEME_RANDOM_BLACKLIST[@]}; do
+ themes=("${(@)themes:#$theme}")
+ done
fi
# Choose a theme out of the pool of candidates
N=${#themes[@]}
(( N = (RANDOM%N) + 1 ))
RANDOM_THEME="${themes[$N]}"
-unset N themes
+unset N themes theme
# Source theme
if [[ -f "$ZSH_CUSTOM/$RANDOM_THEME.zsh-theme" ]]; then