diff --git a/README.md b/README.md index 1d1f378..527257b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Customize the variables (e.g., label and color). You can use the `bash/colors.sh Add the contents of the `ash/powerline.sh` script to your `~/.profile` file. -Customize the label and color. You can use the `bash/colors.sh` script to select a color. +Customize the variables (e.g., label and color). You can use the `bash/colors.sh` script to select a color. ### PowerShell diff --git a/ash/powerline-mini.sh b/ash/powerline-mini.sh new file mode 100644 index 0000000..32392c0 --- /dev/null +++ b/ash/powerline-mini.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +# 30 is the color you may want to modify, \h is the label + +PS1="\n\[\e[1;48;5;30;38;5;231m\] \h \[\e[;38;5;30;48;5;240m\]\[\e[38;5;252m\] \w \[\e[;38;5;240m\]\[\e[m\] " diff --git a/ash/powerline.sh b/ash/powerline.sh index 32392c0..9535149 100644 --- a/ash/powerline.sh +++ b/ash/powerline.sh @@ -1,5 +1,21 @@ #!/bin/sh -# 30 is the color you may want to modify, \h is the label +prompt() { + local label="\h" + local color=30 # 30 green, 131 red + local bold=1 -PS1="\n\[\e[1;48;5;30;38;5;231m\] \h \[\e[;38;5;30;48;5;240m\]\[\e[38;5;252m\] \w \[\e[;38;5;240m\]\[\e[m\] " + prompt_part() { printf "\[\e[$2;38;5;$3;48;5;${4}m\] $1 \[\e[;38;5;$4${5+;48;5;$5}m\]"; } + + printf "\n" + if [ -n "$MC_SID" ]; then + prompt_part "$label" $bold 231 $color 237 + prompt_part "mc" $bold 231 237 240 + else + prompt_part "$label" $bold 231 $color 240 + fi + prompt_part "\w" 0 252 240 + printf "\[\e[m\] " +} + +PS1="$(prompt)"