-
-
Notifications
You must be signed in to change notification settings - Fork 666
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Themes Plugin | ||
|
||
This plugin allows you to change Oh-My-Bash themes on the go. | ||
|
||
To use it, add `themes` to the plugins array in your `.bashrc` file: | ||
|
||
``` | ||
plugins=(... themes) | ||
``` | ||
|
||
This is based off the [themes oh-my-zsh plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/themes). | ||
|
||
## Usage | ||
|
||
`theme <theme_name>` - Changes the theme to specified theme. | ||
|
||
`theme ` - Changes the theme to some random theme. | ||
|
||
`lstheme ` - Lists installed themes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#! bash oh-my-bash.module | ||
|
||
# Load the given theme, or a random one if none is provided. | ||
function theme() { | ||
local desired_theme="$1" | ||
|
||
# Random | ||
if [[ -z "$desired_theme" ]]; then | ||
local theme_files | ||
_omb_util_glob_expand theme_files '"$OSH"/themes/*/*.theme.sh' | ||
theme_files=("${theme_files[@]}") | ||
|
||
if ((${#theme_files[@]})); then | ||
local random_theme=${theme_files[RANDOM%${#theme_files[@]}]} | ||
desired_theme=$(basename $(dirname "$random_theme")) | ||
echo "${_omb_term_reset}theme ${_omb_term_bold}${desired_theme}$_omb_term_reset" | ||
else | ||
echo "No themes found." | ||
return 1 | ||
fi | ||
fi | ||
|
||
_omb_module_require_theme "$desired_theme" | ||
} | ||
|
||
# List all available themes | ||
function lstheme() { | ||
local theme_files | ||
_omb_util_glob_expand theme_files '"$OSH"/themes/*/*.theme.sh' | ||
for i in "${theme_files[@]}"; do | ||
echo $(basename $(dirname "$i")) | ||
done | ||
} |