about summary refs log tree commit diff
path: root/Functions/Prompts/prompt_adam1_setup
diff options
context:
space:
mode:
Diffstat (limited to 'Functions/Prompts/prompt_adam1_setup')
-rw-r--r--Functions/Prompts/prompt_adam1_setup29
1 files changed, 26 insertions, 3 deletions
diff --git a/Functions/Prompts/prompt_adam1_setup b/Functions/Prompts/prompt_adam1_setup
index 65d1b68c0..19b7737eb 100644
--- a/Functions/Prompts/prompt_adam1_setup
+++ b/Functions/Prompts/prompt_adam1_setup
@@ -1,7 +1,30 @@
 # adam1 prompt theme
 
+prompt_adam1_help () {
+  cat <<'EOF'
+This prompt is color-scheme-able.  You can invoke it thus:
+
+  prompt adam1 [<color1> [<color2> [<color3>]]]
+
+where the colors are for the user@host background, current working
+directory, and current working directory if the prompt is split over
+two lines respectively.  The default colors are blue, cyan and green.
+This theme works best with a dark background.
+
+Recommended fonts for this theme: nexus or vga or similar.  If you
+don't have any of these, then specify the `plain' option to use 7-bit
+replacements for the 8-bit characters.
+
+And you probably thought adam1 was overkill.
+EOF
+}
+
 prompt_adam1_setup () {
-  base_prompt="%{$bg_no_bold_blue%}%n@%m%{$reset_color%} "
+  prompt_adam1_color1=${1:-'blue'}
+  prompt_adam1_color2=${2:-'cyan'}
+  prompt_adam1_color3=${3:-'green'}
+
+  base_prompt="%{$bg_no_bold[$prompt_adam1_color1]%}%n@%m%{$reset_color%} "
   post_prompt="%{$reset_color%}"
 
   base_prompt_no_color=$(echo "$base_prompt" | perl -pe "s/%{.*?%}//g")
@@ -20,10 +43,10 @@ prompt_adam1_precmd () {
   base_prompt_etc=$(print -P "$base_prompt%(4~|...|)%3~")
   prompt_length=${#base_prompt_etc}
   if [[ $prompt_length -lt 40 ]]; then
-    path_prompt="%{$fg_bold_cyan%}%(4~|...|)%3~%{$fg_bold_white%}"
+    path_prompt="%{$fg_bold[$prompt_adam1_color2]%}%(4~|...|)%3~%{$fg_bold[white]%}"
   else
     space_left=$(( $COLUMNS - $#base_prompt_expanded_no_color - 2 ))
-    path_prompt="%{$fg_bold_green%}%${space_left}<...<%~$prompt_newline%{$fg_bold_white%}"
+    path_prompt="%{$fg_bold[$prompt_adam1_color3]%}%${space_left}<...<%~$prompt_newline%{$fg_bold_white%}"
   fi
   PS1="$base_prompt$path_prompt %# $post_prompt"
   PS2="$base_prompt$path_prompt %_> $post_prompt"