Browse code

Feature: Random themes now supported. Just set your theme to 'random' and it'll load a different theme each time oh-my-zsh is started. Closes #309

Robby Russell authored on 29/04/2011 at 09:24:29
Showing 2 changed files
... ...
@@ -15,7 +15,19 @@ plugin=${plugin:=()}
15 15
 for plugin ($plugins) source $ZSH/plugins/$plugin/$plugin.plugin.zsh
16 16
 
17 17
 # Load the theme
18
-source "$ZSH/themes/$ZSH_THEME.zsh-theme"
18
+# Check for updates on initial load...
19
+if [ "$ZSH_THEME" = "random" ]
20
+then
21
+  themes=($ZSH/themes/*zsh-theme)
22
+  N=${#themes[@]}
23
+  ((N=RANDOM%N))
24
+  RANDOM_THEME=${themes[$N]}
25
+  source "$RANDOM_THEME"
26
+  echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..."
27
+else
28
+  source "$ZSH/themes/$ZSH_THEME.zsh-theme"
29
+fi
30
+
19 31
 
20 32
 # Check for updates on initial load...
21 33
 if [ "$DISABLE_AUTO_UPDATE" = "true" ]
... ...
@@ -1,8 +1,10 @@
1 1
 # Path to your oh-my-zsh configuration.
2 2
 export ZSH=$HOME/.oh-my-zsh
3 3
 
4
-# Set to the name theme to load.
4
+# Set name of the theme to load.
5 5
 # Look in ~/.oh-my-zsh/themes/
6
+# Optionally, if you set this to "random", it'll load a random theme each
7
+# time that oh-my-zsh is loaded.
6 8
 export ZSH_THEME="robbyrussell"
7 9
 
8 10
 # Set to this to use case-sensitive completion