angle="❯" NO_FORMAT="\033[0m" fg="\033[38;2;" bg="\033[48;2;" function col() { red="$1" grn="$2" blu="$3" if [[ "$4" == "b" ]]; then echo "$bg$red;$grn;$blu"m else echo "$fg$red;$grn;$blu"m fi } rad_red="$(col 255 53 94)" vsoft_red="$(col 237 137 157)" lime_green="$(col 54 178 91)" gray="$(col 70 70 70)" mod_blue="$(col 49 142 193)" dark_cyan="$(col 0 139 139)" strong_orng="$(col 193 79 29)" #If user is root if [[ "$USER" == "root" ]]; then angle1_col="$rad_red"; home_col="$rad_red"; else angle1_col="$lime_green"; home_col="$lime_green"; fi dir=$(pwd) git_branch=$(git status 2>/dev/null | cut -d" " -f3 | sd "\n.*" "") if [[ -n $git_branch ]]; then repo="$(git rev-parse --show-toplevel)" if [[ $git_branch == "main" ]]; then branch_col="$strong_orng" else branch_col="$gray" fi dir="$(echo $dir | sd "$repo/" "$(basename $repo) $branch_col󰊢 $gray:")" angle3_col="$dark_cyan"; else angle3_col="$gray"; fi dir="$(echo $dir | sd "^$HOME" "$home_col~$gray")" case "$SHELL" in "/bin/bash") shell_char="" ;; "/usr/bin/zsh") shell_char="󰰶" ;; "/usr/bin/fish") shell_char="" ;; *) shell_char="󱆃" esac #If previous commant was successful if [[ $? -eq 0 ]]; then angle2_col="$lime_green"; else angle2_col="$rad_red"; fi prompt="$gray$shell_char $gray$dir$angle1_col$angle$angle2_col$angle$angle3_col$angle $NO_FORMAT" echo "$prompt" #export PS1="$prompt"