From c7af516ea87423b33447e8567f213b6debd0ef74 Mon Sep 17 00:00:00 2001 From: Candifloss Date: Mon, 12 Aug 2024 18:28:36 +0000 Subject: [PATCH] Incomplete but basic bash prompt theming --- bash/bash_prompt.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 bash/bash_prompt.sh diff --git a/bash/bash_prompt.sh b/bash/bash_prompt.sh new file mode 100644 index 0000000..a467c9c --- /dev/null +++ b/bash/bash_prompt.sh @@ -0,0 +1,31 @@ +angle="❯" + +NO_FORMAT="\033[0m" + +C_SEAGREEN2="\033[38;5;83m" +C_INDIANRED1="\033[38;5;203m" +C_GREY89="\033[38;5;254m" + +#If user is root +if [[ "$USER" == "root" ]]; then + char1_col="$C_SEAGREEN2"; + home_col="$C_INDIANRED1"; +else + char1_col="$C_GREY89"; + home_col="$C_SEAGREEN2"; +fi + +#If previous commant was successful +if [[ "$?" -eq "0" ]]; then + char4_col="$C_SEAGREEN2"; +else + char4_col="$C_INDIANRED1"; +fi + +char3_col="$C_SEAGREEN2"; + +dir=$(pwd | sd "$HOME" "$home_col~$NO_FORMAT") + +prompt="$dir" + +echo -e "$dir$char1_col$angle$NO_FORMAT$angle$char3_col$angle$char4_col$angle$NO_FORMAT" \ No newline at end of file