aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.markdown4
-rw-r--r--bash/bashrc.d/prompt.bash11
2 files changed, 10 insertions, 5 deletions
diff --git a/README.markdown b/README.markdown
index 468b8c45..2a8f1492 100644
--- a/README.markdown
+++ b/README.markdown
@@ -143,8 +143,8 @@ It expands based on context to include these elements in this order:
* The number of running background jobs, if non-zero
* The exit status of the last command, if non-zero
-You can set `PROMPT_PREFIX` and/or `PROMPT_SUFFIX` too, which do about what
-you’d expect.
+You can set `PROMPT_COLOR`, `PROMPT_PREFIX`, and `PROMPT_SUFFIX` too, which all
+do about what you’d expect.
This is all managed within the `prompt` function. There’s some mildly hacky
logic on `tput` codes included such that it should work correctly for most
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash
index d4ec0645..4c82cec0 100644
--- a/bash/bashrc.d/prompt.bash
+++ b/bash/bashrc.d/prompt.bash
@@ -49,15 +49,20 @@ prompt() {
# Check if we have non-bold bright green available
256)
format=$( {
- tput AF 10 || tput setaf 10 \
- || tput AF 10 0 0 || tput setaf 10 0 0
+ : "${PROMPT_COLOR:=10}"
+ tput AF "$PROMPT_COLOR" \
+ || tput setaf "$PROMPT_COLOR" \
+ || tput AF "$PROMPT_COLOR" 0 0 \
+ || tput setaf "$PROMPT_COLOR" 0 0
} 2>/dev/null )
;;
# If we have only eight colors, use bold green
8)
format=$( {
- tput AF 2 || tput setaf 2
+ : "${PROMPT_COLOR:=2}"
+ tput AF "$PROMPT_COLOR" \
+ || tput setaf "$PROMPT_COLOR"
tput md || tput bold
} 2>/dev/null )
;;