Go to file
Jens Petersen f2daf2ccc6 move the examples around
should probably all be consolidated in readme
2023-11-11 18:01:09 +08:00
.gitignore import #2226663 2023-08-21 23:42:22 +08:00
bash-color-prompt.sh move the examples around 2023-11-11 18:01:09 +08:00
COPYING import #2226663 2023-08-21 23:42:22 +08:00
README.md add PROMPT_BRACKETS to surround the prompt with traditional brackets 2023-11-10 15:47:22 +08:00
shell-color-prompt.spec add a container symbol prefix 2023-11-11 18:00:45 +08:00
sources import #2226663 2023-08-21 23:42:22 +08:00

Simple colored bash prompt

The prompt color theme can be customized simply by setting 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 similarly changes the color of the working directory, which otherwise defaults to PROMPT_COLOR.

The prompt can be bracketed to look more like the traditional Fedora prompt by setting PROMPT_BRACKETS.

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 or bash default.

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.

Please open issues against shell-color-prompt.

References

See https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters etc for the ANSI codes.