mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Functions for changing and listing themes
This commit is contained in:
parent
580df9b202
commit
d136c535f1
1 changed files with 29 additions and 0 deletions
29
plugins/theme-tools/theme-tools.plugin.zsh
Normal file
29
plugins/theme-tools/theme-tools.plugin.zsh
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
ZSH_THEMES=$ZSH/themes
|
||||
|
||||
function change_theme() {
|
||||
if [ $1 ] && theme_name=${1%.zsh-theme}; then
|
||||
printf "Changing theme... "
|
||||
|
||||
if [ -f $ZSH_THEMES/$theme_name.zsh-theme ]; then
|
||||
source $ZSH_THEMES/$theme_name.zsh-theme
|
||||
export ZSH_THEME=$theme_name
|
||||
echo "$fg_bold[green]Done"
|
||||
else
|
||||
printf "$fg_bold[red]Notice$reset_color: "
|
||||
echo "Could not find theme: '$theme_name.zsh-theme' in $ZSH_THEMES"
|
||||
fi
|
||||
|
||||
else
|
||||
echo "change_theme: no theme given"
|
||||
fi
|
||||
}
|
||||
|
||||
function list_themes() {
|
||||
more < <(
|
||||
echo "Themes available (press 'q' to quit)"
|
||||
echo "===================================="
|
||||
for theme ($ZSH_THEMES/*)
|
||||
do
|
||||
echo "${${theme%.zsh-theme}##*/}"
|
||||
done)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue