Commit 3d4890dc authored by Marc Cornellà's avatar Marc Cornellà
Browse files

Add blacklist variable for random theme


Co-authored-by: default avatarFran Garcia <fran.miranda@gmail.com>
parent f4b4a446
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment