diff options
author | mail_redacted_for_web | 2023-05-06 10:44:53 +0200 |
---|---|---|
committer | mail_redacted_for_web | 2023-05-06 10:44:53 +0200 |
commit | 6c6b1f1c7ae29bc5cda8982a99eb21836ab14d98 (patch) | |
tree | fb6aa56044cf7cb2d648cc863526fabe170a1ab2 | |
parent | e27c0a03d5c5163bfd9df624368d458041c87521 (diff) | |
download | dotfiles-6c6b1f1c7ae29bc5cda8982a99eb21836ab14d98.tar.bz2 |
New colours for Debian > 12 and derivatives
- Distinguish Debian >= 12 – Debian 12 introduces emerald theming
- Corporate work includes refined Ubuntu settings. Adjusting to
match Ubuntu >= 22
-rw-r--r-- | .bash/prompt.bash | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/.bash/prompt.bash b/.bash/prompt.bash index 9908c56..314aa1b 100644 --- a/.bash/prompt.bash +++ b/.bash/prompt.bash @@ -17,11 +17,19 @@ bgcolor () { # stupid old asterisk (*). Well, here hetting "no digits" practically won't hurt. MYUID="$(id|sed 's/.*uid=\([0-9]*\).*/\1/g')";export MYUID # ...because "empty" will hit the "any" condition in the end :) +OSMAJVER="$(grep '^VERSION_ID' /etc/os-release|awk -F= '{print $NF}'|sed 's/"//g'|awk -F\. '{print $1}')" case "$MYUID" in 0) FGC1="fgcolor 88" case "$OSNAME" in - debian) FGC3="fgcolor 38";FGC2="fgtcolor 155 15 64";; + debian) + # Debian 12 = emerald + if [ "$OSMAJVER" -ge 12 ];then + FGC3="fgcolor 36";FGC2="fgtcolor 155 15 64" + else + FGC3="fgcolor 38";FGC2="fgcolor 155 15 64" + fi + ;; arch) FGC2="fgcolor 24";FGC3="fgcolor 240";; redhat) FGC1="fgcolor 23";FGC2="fgcolor 88";FGC3="fgcolor 203";; fedora) FGC1="fgcolor 160";FGC2="fgcolor 88";FGC3="fgcolor 203";; @@ -33,7 +41,17 @@ case "$MYUID" in aix) FGC2="fgcolor 238";FGC3="fgcolor 83";; *centos*) FGC2="fgcolor 25";FGC3="fgcolor 208";; *solaris) FGC2="fgcolor 31";FGC3="fgcolor 124";; - ubuntu) FGC2="fgcolor 130";FGC3="fgcolor 215";; + ubuntu) + if [ "$OSMAJVER" -ge 22 ];then + if printf "%b" "$TERM"|grep -P 'xterm|256' > /dev/null;then + FGC2="fgcolor 89";FGC3="fgcolor 208" + else + FGC2="fgcolor 53";FGC3="fgcolor 184" + fi + else + FGC2="fgcolor 130";FGC3="fgcolor 215" + fi + ;; rasp*) FGC2="fgcolor 253";FGC3="fgcolor 126";; rocky) FGC2="fgcolor 22";FGC3="fgcolor 41";; *) FGC2="fgcolor 240";FGC3="fgcolor 244";; @@ -47,7 +65,13 @@ case "$MYUID" in *) FGC2="fgcolor 253" case "$OSNAME" in - debian) FGC1="fgtcolor 155 15 64";FGC3="fgcolor 38";; + debian) + if [ "$OSMAJVER" -ge 12 ];then + FGC1="fgtcolor 155 15 64";FGC3="fgcolor 36" + else + FGC1="fgtcolor 155 15 64";FGC3="fgcolor 38" + fi + ;; arch) FGC1="fgcolor 24";FGC3="fgcolor 239";; redhat) FGC1="fgcolor 23";FGC3="fgcolor 88";; fedora) FGC1="fgcolor 88";FGC3="fgcolor 203";; @@ -57,7 +81,17 @@ case "$MYUID" in aix) FGC1="fgcolor 238";FGC3="fgcolor 83";; *centos*) FGC1="fgcolor 25";FGC3="fgcolor 208";; *solaris) FGC1="fgcolor 31";FGC3="fgcolor 124";; - ubuntu) FGC1="fgcolor 130";FGC3="fgcolor 215";; + ubuntu) + if [ "$OSMAJVER" -ge 22 ];then + if printf "%b" "$TERM"|grep -P 'xterm|256' > /dev/null;then + FGC1="fgcolor 89";FGC3="fgcolor 208" + else + FGC1="fgcolor 53";FGC3="fgcolor 184" + fi + else + FGC1="fgcolor 130";FGC3="fgcolor 215" + fi + ;; rasp*) FGC1="fgcolor 53";FGC3="fgcolor 126";; rocky) FGC1="fgcolor 22";FGC3="fgcolor 41";; *) FGC1="fgcolor 240";FGC3="fgcolor 244";; |