about summary refs log tree commit diff
path: root/Functions/Prompts/prompt_bigfade_setup
blob: 89ae44981f09ef82d50e0ae783c34e78d1c31fbe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Generic large colour fade-bar prompt theme from bashprompt
# Created by James Manning <jmm@raleigh.ibm.com>
# Changed by Spidey 08/06
# Converted to zsh prompt theme by <adam@spiers.net>

prompt_bigfade_help () {
  cat <<EOH
This prompt is color-scheme-able.  You can invoke it thus:

  prompt bigfade [<fade-bar> [<userhost> [<date> [<cwd>]]]]

where the parameters are the colors for the fade-bar, user@host text,
date text, and current working directory respectively.  The default
colors are blue, white, white, and yellow.  This theme works best with
a dark background.


Recommended fonts for this theme: either UTF-8, or nexus or vga or similar.
If you don't have any of these, the 8-bit characters will probably look
stupid.
EOH
}

prompt_bigfade_setup () {
  local fadebar=${1:-'blue'}
  local userhost=${2:-'white'}
  local date=${3:-'white'}
  local cwd=${4:-'yellow'}

  local char_333 char_262 char_261 char_260
  autoload -U prompt_special_chars
  prompt_special_chars

  PS1="%{$bold_color$fg[$fadebar]$bold_color%}$char_333$char_262$char_261$char_260%{$bold_color$fg[$userhost]$bg[$fadebar]%}%n@%m%{$reset_color$fg[$fadebar]$bg[grey]%}$char_260$char_261$char_262$char_333%{$reset_color$fg[$fadebar]$bg[grey]%}$char_333$char_262$char_261$char_260%{$bold_color$fg[$date]$bg[grey]%} %D{%a %b %d} %D{%I:%M:%S%P}$prompt_newline%{$bold_color$fg[$cwd]$bg[grey]%}$PWD>%{$reset_color%} "
  PS2="%{$bold_color$fg[$fadebar]$bold_color%}$char_333$char_262$char_261$char_260%{$reset_color$fg[$fadebar]$bg[grey]%}$char_260$char_261$char_262$char_333%{$reset_color$fg[$fadebar]$bg[grey]%}$char_333$char_262$char_261$char_260%{$bold_color$bold_color$fg[$fadebar]%}>%{$reset_color%} "

  precmd () { setopt promptsubst }
  preexec () { }
}

prompt_bigfade_preview () {
  if (( ! $#* )); then
    prompt_preview_theme bigfade
    print
    prompt_preview_theme bigfade red white grey white
  else
    prompt_preview_theme bigfade "$@"
  fi
}

prompt_bigfade_setup "$@"