#!/usr/bin/env bash clear echo "" branch="branch-name" staged=2 conflicts=1 changed=3 untracked=4 stashed=2 ahead=1 behind=1 has_remote=0 is_clean=0 print_theme() { local theme=$1 local suppress_newline=$2 local suppress_label=$3 case "$theme" in 2|3) BRANCH_ICON=" " STAGED_ICON="" CHANGED_ICON="±" UNTRACKED_ICON="" STASHED_ICON="" AHEAD_ICON="" BEHIND_ICON="" NO_REMOTE_ICON="" CONFLICT_ICON="✘" DIRTY_ICON="✘" CLEAN_ICON="✔" ;; 4) BRANCH_ICON="⎇ " STAGED_ICON="o" CONFLICT_ICON="!" CHANGED_ICON="±" UNTRACKED_ICON="…" STASHED_ICON="☰" AHEAD_ICON="⇡" BEHIND_ICON="⇣" NO_REMOTE_ICON="-" CLEAN_ICON="✓" DIRTY_ICON="✗" ;; 5) BRANCH_ICON="::" STAGED_ICON="+" CONFLICT_ICON="x" CHANGED_ICON="*" UNTRACKED_ICON="?" STASHED_ICON="s" AHEAD_ICON="a" BEHIND_ICON="b" NO_REMOTE_ICON="no" CLEAN_ICON="ok" DIRTY_ICON="!" ;; *) BRANCH_ICON=" " STAGED_ICON="" CONFLICT_ICON="✘" CHANGED_ICON="±" UNTRACKED_ICON="" STASHED_ICON="" AHEAD_ICON="" BEHIND_ICON="" NO_REMOTE_ICON="" CLEAN_ICON="✔" DIRTY_ICON="✘" ;; esac if [[ "$suppress_label" != "true" ]]; then if [[ "$theme" == "1" || "$theme" == "2" || "$theme" == "3" ]]; then echo -e "\e[1mTheme $theme:\e[0m This theme requires DejaVuSansMono Nerd Font Mono font" elif [[ "$theme" == "4" ]]; then echo -e "\e[1mTheme $theme:\e[0m Unicode" elif [[ "$theme" == "5" ]]; then echo -e "\e[1mTheme $theme:\e[0m Terminal Safe" else echo -e "\e[1mTheme $theme:\e[0m" fi fi if [[ "$theme" == "2" ]]; then printf "\e[30;44m" printf "\e[97;44m %s%s" "$BRANCH_ICON" "$branch" printf " %s%d" "$STAGED_ICON" "$staged" printf " %s%d" "$CHANGED_ICON" "$changed" printf " %s%d" "$UNTRACKED_ICON" "$untracked" printf " %s%d" "$STASHED_ICON" "$stashed" printf " %s%d" "$AHEAD_ICON" "$ahead" printf " %s%d" "$BEHIND_ICON" "$behind" (( has_remote == 0 )) && printf " %s" "$NO_REMOTE_ICON" printf " %s%d" "$CONFLICT_ICON" "$conflicts" printf " %s %s" "$DIRTY_ICON" "$CLEAN_ICON" printf "\e[0m\e[34;107m" printf "\e[30;107m ~/some-directory" printf "\e[97;49m" printf "\e[0m \$\n" elif [[ "$theme" == "3" ]]; then printf "\e[0;37m┌──[\e[0m" printf "\e[38;5;117m%s%s\e[0m" "$BRANCH_ICON" "$branch" printf " \e[38;5;196m%s%d" "$STAGED_ICON" "$staged" printf " \e[38;5;69m%s%d" "$CHANGED_ICON" "$changed" printf " \e[38;5;41m%s%d" "$UNTRACKED_ICON" "$untracked" printf " \e[38;5;226m%s%d" "$STASHED_ICON" "$stashed" printf " \e[0;37m%s%d" "$AHEAD_ICON" "$ahead" printf " \e[0;37m%s%d" "$BEHIND_ICON" "$behind" (( has_remote == 0 )) && printf " \e[38;5;250m%s" "$NO_REMOTE_ICON" printf " \e[38;5;196m%s%d" "$CONFLICT_ICON" "$conflicts" printf " \e[38;5;196m%s \e[0;32m%s" "$DIRTY_ICON" "$CLEAN_ICON" printf "\e[0;37m] \e[38;5;178m~/some-directory\e[0m\e[0m\n" printf "\e[0;37m└─\e[0m \$\n" else printf "\e[0;37m[\e[0m" printf "\e[38;5;117m%s%s\e[0m" "$BRANCH_ICON" "$branch" printf " \e[38;5;196m%s%d" "$STAGED_ICON" "$staged" printf " \e[38;5;69m%s%d" "$CHANGED_ICON" "$changed" printf " \e[38;5;41m%s%d" "$UNTRACKED_ICON" "$untracked" printf " \e[38;5;226m%s%d" "$STASHED_ICON" "$stashed" printf " \e[0;37m%s%d" "$AHEAD_ICON" "$ahead" printf " \e[0;37m%s%d" "$BEHIND_ICON" "$behind" (( has_remote == 0 )) && printf " \e[38;5;250m%s" "$NO_REMOTE_ICON" printf " \e[38;5;196m%s%d" "$CONFLICT_ICON" "$conflicts" printf " \e[38;5;196m%s \e[0;32m%s" "$DIRTY_ICON" "$CLEAN_ICON" printf "\e[0;37m]\e[0m" printf " \e[38;5;178m~/some-directory\e[0m \$\n" fi [[ "$suppress_newline" != "true" ]] && echo } # Print all 5 themes for t in {1..5}; do print_theme "$t" done # Two newlines echo -e "\n" # Reprint theme 1 with no label and no trailing newline # print_theme 1 true true