summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2025-03-01 12:20:00 +0200
committerSyndamia <kamen@syndamia.com>2025-03-01 12:20:00 +0200
commite406848e48b4bef66572d94feead19a4f382a561 (patch)
treeb3daeea448c21a940a5f1335016d5be2f73a6912
parentce64d7af6cd5985eb135a86e43eec08d7b4d5aed (diff)
downloaddotfiles-e406848e48b4bef66572d94feead19a4f382a561.tar
dotfiles-e406848e48b4bef66572d94feead19a4f382a561.tar.gz
dotfiles-e406848e48b4bef66572d94feead19a4f382a561.zip
feat(bash): Improve coloring escape sequences for low-color terminals
-rw-r--r--.bashrc10
1 files changed, 8 insertions, 2 deletions
diff --git a/.bashrc b/.bashrc
index a6b4f75..a7ba14c 100644
--- a/.bashrc
+++ b/.bashrc
@@ -33,10 +33,15 @@ export PROMPT_COMMAND="shell_var_fix;"
# $1 foreground color [REQUIRED]
# $2 background color [REQUIRED]
colors_prt() {
- printf "\001\e[38;5;${1}m\e[48;5;${2}m\002"
+ if hc_mode
+ then
+ printf "\001\e[38;5;${1}m\e[48;5;${2}m\002"
+ else
+ printf "\001\e[${1}m\e[${2}m\002"
+ fi
}
colors_res() {
- printf "\001\e[39m\e[49m\002"
+ printf "\001\e[0m\002"
}
# $1 cap colour [OPTIONAL]
@@ -194,6 +199,7 @@ export PROMPT_COMMAND="shell_var_fix;"
}
ps_precursor() {
+ colors_res
[ ! -w . ] && colors_prt "$PS_WARN" "$PS_BG"
if [ -n "$___changes" ]
then