From 54fbbf9e4876d8fd05caa6695b68b53c5c4d98c2 Mon Sep 17 00:00:00 2001 From: "Clarence \"Sparr\" Risher" Date: Tue, 19 Apr 2016 16:17:03 -0700 Subject: [PATCH] add support for randomly selecting from a list of specific themes --- oh-my-zsh.sh | 7 +++++++ templates/zshrc.zsh-template | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 6cc5ac630..e9569f658 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -92,6 +92,13 @@ for config_file ($ZSH_CUSTOM/*.zsh(N)); do done unset config_file +if [[ "$(declare -p ZSH_THEME) 2>/dev/null" =~ "(declare|typeset) -a" ]]; then + # Choose randomly from multiple specified themes + THEME_COUNT=${#ZSH_THEME[@]} + ((THEME_N=(RANDOM%THEME_COUNT)+1)) + ZSH_THEME=${ZSH_THEME[$THEME_N]} +fi + # Load the theme if [ "$ZSH_THEME" = "random" ]; then themes=($ZSH/themes/*zsh-theme) diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template index 44e8b0d1b..3bd4feb68 100644 --- a/templates/zshrc.zsh-template +++ b/templates/zshrc.zsh-template @@ -3,9 +3,12 @@ export ZSH=$HOME/.oh-my-zsh # Set name of the theme to load. # Look in ~/.oh-my-zsh/themes/ -# Optionally, if you set this to "random", it'll load a random theme each -# time that oh-my-zsh is loaded. ZSH_THEME="robbyrussell" +# Optionally, if you set this to "random", it'll load a random non-custom +# theme each time that oh-my-zsh is loaded. +# ZSH_THEME="random" +# This can also be a list of specific themes to be chosen between at random +# ZSH_THEME=(arrow gallifrey robbyrussell smt wedisagree) # Uncomment the following line to use case-sensitive completion. # CASE_SENSITIVE="true"