diff --git a/README.md b/README.md index eefd77d..fa585d7 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,19 @@ # Simple colored bash prompt The prompt color theme can be customized simply by setting -the `PROMPT_COLOR` envvar. +the `PROMPT_COLOR` envvar, and optionally `PROMPT_DIR_COLOR`. For example `PROMPT_COLOR='2;7'` is dim inverse-video and `PROMPT_COLOR='1;33;53'` is bright/bold yellow with overline. +`PROMPT_DIR_COLOR` changes the color of the working directory, +which otherwise defaults to `PROMPT_COLOR`. + Set `prompt_color_force` (before source'ing) to force usage/updating of color PS1: by default it is only setup cautiously if `$TERM` ends in "color" *and* PS1 is the fedora default. -Also set `PROMPT_ERROR` if you want to append red error exit codes to the prompt. +Also you can set `PROMPT_ERROR` if you want to append red error exit code to the prompt. See `/etc/profile.d/bash-color-prompt.sh` for the actual script. diff --git a/bash-color-prompt.sh b/bash-color-prompt.sh index 1ee2f65..b95b8c5 100644 --- a/bash-color-prompt.sh +++ b/bash-color-prompt.sh @@ -16,5 +16,5 @@ if [ "$PS1" = "[\u@\h \W]\\$ " -a "${TERM: -5}" = "color" -o -n "${prompt_color_ # PROMPT_COLOR='1;33;44' # bold yellow on blue # PROMPT_COLOR='1;32' # bold green # PROMPT_COLOR='' # unset defaults to green - PS1='\[\e[${PROMPT_COLOR:-32}m\]\u@\h\[\e[0m\]:\[\e[${PROMPT_COLOR:-32}m\]\w${PROMPT_ERROR:+\[\e[0;31m\]${?#0}}\[\e[0m\]\$ ' + PS1='\[\e[${PROMPT_COLOR:-32}m\]\u@\h\[\e[0m\]:\[\e[${PROMPT_DIR_COLOR:-${PROMPT_COLOR:-32}}m\]\w${PROMPT_ERROR:+\[\e[0;31m\]${?#0}}\[\e[0m\]\$ ' fi diff --git a/shell-color-prompt.spec b/shell-color-prompt.spec index 97e4152..ec37e00 100644 --- a/shell-color-prompt.spec +++ b/shell-color-prompt.spec @@ -1,6 +1,6 @@ Name: shell-color-prompt -Version: 0.1.1 -Release: 2%{?dist} +Version: 0.2 +Release: 1%{?dist} Summary: Color prompt for bash shell License: GPL-2.0-or-later @@ -41,8 +41,8 @@ install -m 644 -D -t %{buildroot}%{profiledir} bash-color-prompt.sh %changelog -* Thu Nov 9 2023 Jens Petersen - 0.1.1-2 -- fixup PROMPT_ERROR change to include the red color code +* Fri Nov 10 2023 Jens Petersen - 0.2-1 +- add PROMPT_DIR_COLOR to change the dir color (Thomas Steenholdt, #2239152) * Thu Nov 9 2023 Jens Petersen - 0.1.1-1 - only show error code if PROMPT_ERROR set