1- set --query ayu_path || set --local ayu_path $_ _fish_config_dir
2- switch $ayu_variant
3- case light
4- source $ayu_path /conf.d/ayu-light.fish && enable_ayu_theme_light
5- case dark
6- source $ayu_path /conf.d/ayu-dark.fish && enable_ayu_theme_dark
7- case mirage
8- source $ayu_path /conf.d/ayu-mirage.fish && enable_ayu_theme_mirage
1+ function ayu_load_theme
2+ set --query ayu_path || set --local ayu_path $_ _fish_config_dir
3+
4+ switch $ayu_variant
5+ case light
6+ source $ayu_path /conf.d/ayu-light.fish && enable_ayu_theme_light
7+ and colorize " Ayu %s light %s enabled!\n"
8+ case dark
9+ source $ayu_path /conf.d/ayu-dark.fish && enable_ayu_theme_dark
10+ and colorize " Ayu %s dark %s enabled!\n"
11+ case mirage
12+ source $ayu_path /conf.d/ayu-mirage.fish && enable_ayu_theme_mirage
13+ and colorize " Ayu %s mirage %s enabled!\n"
14+ case ' *'
15+ echo ' ⚠️ Invalid variant, choose among: light, dark or mirage'
16+ end
17+ end
18+
19+ function colorize \
20+ --argument-names text
21+ printf $text (set_color $fish_color_quote --reverse ) (set_color normal)
922end
1023
1124function _ayu_save_current_theme
12- set --query ayu_path || set --local ayu_path $_ _fish_config_dir
1325 set --local previous_theme_file $_ _fish_config_dir/functions /_ayu_restore_previous_theme.fish
1426
1527 test -e $previous_theme_file && command rm -f $previous_theme_file
@@ -25,8 +37,8 @@ function _ayu_save_current_theme
2537end
2638
2739function _ayu_install --on-event ayu_install
28- echo ' _ayu_save_current_theme'
2940 _ayu_save_current_theme
41+ and echo ' Previous theme saved! 🎉'
3042end
3143
3244function _ayu_uninstall --on-event ayu_uninstall
@@ -40,3 +52,12 @@ function _ayu_uninstall --on-event ayu_uninstall
4052 functions --erase _ayu_restore_previous_theme
4153 set --erase ayu_variant
4254end
55+
56+ function ayu_display_colorscheme
57+ set color_vars (set --names | grep fish_color)
58+ for color_var in $color_vars
59+ printf " %-30s %s\n" \
60+ $color_var \
61+ (set_color $$color_var --reverse )" $$color_var " (set_color normal)
62+ end
63+ end
0 commit comments