Skip to content
This repository has been archived by the owner on Apr 30, 2020. It is now read-only.

Added coloring of SEC1, PATH, GIT, B sections. #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 31 additions & 0 deletions README.md
Expand Up @@ -67,12 +67,43 @@ If you want to display a custom text next to time:
POWERLINE_RIGHT_A="blackfire.io"
```

If you want to swap A and B sections (so the clock in always on the edge of the screen):
```
POWERLINE_RIGHT_ORDER="AB"
```

If you want to change the color of the `POWERLINE_RIGHT_A` element:
```
POWERLINE_RIGHT_A_COLOR_FRONT="black"
POWERLINE_RIGHT_A_COLOR_BACK="red"
```

If you want to change the color of the `POWERLINE_RIGHT_B` element:
```
POWERLINE_RIGHT_B_COLOR_FRONT="white"
POWERLINE_RIGHT_B_COLOR_BACK="blue"
```

If you want to change the color of the `POWERLINE_SEC1` element (this is user@machine part, ROOT is self-explanatory):
```
POWERLINE_SEC1_COLOR_FRONT="white"
POWERLINE_SEC1_COLOR_BACK="black"
POWERLINE_SEC1_ROOT_COLOR_FRONT="white"
POWERLINE_SEC1_ROOT_COLOR_BACK="red"
```

If you want to change the color of the `POWERLINE_GIT` element:
```
POWERLINE_GIT_COLOR_FRONT="white"
POWERLINE_GIT_COLOR_BACK="black"
```

If you want to change the color of the `POWERLINE_PATH` element:
```
POWERLINE_PATH_COLOR_FRONT="black"
POWERLINE_PATH_COLOR_BACK="yellow"
```

If you want to change the date format to what you want:
```
POWERLINE_DATE_FORMAT="%D{%d-%m}"
Expand Down
95 changes: 69 additions & 26 deletions powerline.zsh-theme
Expand Up @@ -37,55 +37,95 @@ else
fi

if [ "$POWERLINE_PATH" = "full" ]; then
POWERLINE_PATH="%1~"
POWERLINE_PATH="%1~"
elif [ "$POWERLINE_PATH" = "short" ]; then
POWERLINE_PATH="%~"
POWERLINE_PATH="%~"
else
POWERLINE_PATH="%d"
POWERLINE_PATH="%d"
fi

if [ "$POWERLINE_CUSTOM_CURRENT_PATH" != "" ]; then
POWERLINE_CURRENT_PATH="$POWERLINE_CUSTOM_CURRENT_PATH"
POWERLINE_CURRENT_PATH="$POWERLINE_CUSTOM_CURRENT_PATH"
fi

if [ "$POWERLINE_GIT_CLEAN" = "" ]; then
POWERLINE_GIT_CLEAN="✔"
POWERLINE_GIT_CLEAN="✔"
fi

if [ "$POWERLINE_GIT_DIRTY" = "" ]; then
POWERLINE_GIT_DIRTY="✘"
POWERLINE_GIT_DIRTY="✘"
fi

if [ "$POWERLINE_GIT_ADDED" = "" ]; then
POWERLINE_GIT_ADDED="%F{green}✚%F{black}"
POWERLINE_GIT_ADDED="%F{green}✚%F{black}"
fi

if [ "$POWERLINE_GIT_MODIFIED" = "" ]; then
POWERLINE_GIT_MODIFIED="%F{blue}✹%F{black}"
POWERLINE_GIT_MODIFIED="%F{blue}✹%F{black}"
fi

if [ "$POWERLINE_GIT_DELETED" = "" ]; then
POWERLINE_GIT_DELETED="%F{red}✖%F{black}"
POWERLINE_GIT_DELETED="%F{red}✖%F{black}"
fi

if [ "$POWERLINE_GIT_UNTRACKED" = "" ]; then
POWERLINE_GIT_UNTRACKED="%F{yellow}✭%F{black}"
POWERLINE_GIT_UNTRACKED="%F{yellow}✭%F{black}"
fi

if [ "$POWERLINE_GIT_RENAMED" = "" ]; then
POWERLINE_GIT_RENAMED="➜"
POWERLINE_GIT_RENAMED="➜"
fi

if [ "$POWERLINE_GIT_UNMERGED" = "" ]; then
POWERLINE_GIT_UNMERGED="═"
POWERLINE_GIT_UNMERGED="═"
fi

if [ "$POWERLINE_RIGHT_A_COLOR_FRONT" = "" ]; then
POWERLINE_RIGHT_A_COLOR_FRONT="white"
POWERLINE_RIGHT_A_COLOR_FRONT="white"
fi

if [ "$POWERLINE_RIGHT_A_COLOR_BACK" = "" ]; then
POWERLINE_RIGHT_A_COLOR_BACK="black"
POWERLINE_RIGHT_A_COLOR_BACK="black"
fi

if [ "$POWERLINE_RIGHT_B_COLOR_FRONT" = "" ]; then
POWERLINE_RIGHT_B_COLOR_FRONT="black"
fi

if [ "$POWERLINE_RIGHT_B_COLOR_BACK" = "" ]; then
POWERLINE_RIGHT_B_COLOR_BACK="yellow"
fi

if [ "$POWERLINE_GIT_COLOR_FRONT" = "" ]; then
POWERLINE_GIT_COLOR_FRONT="white"
fi

if [ "$POWERLINE_GIT_COLOR_BACK" = "" ]; then
POWERLINE_GIT_COLOR_BACK="black"
fi

if [ "$POWERLINE_PATH_COLOR_FRONT" = "" ]; then
POWERLINE_PATH_COLOR_FRONT="white"
fi

if [ "$POWERLINE_PATH_COLOR_BACK" = "" ]; then
POWERLINE_PATH_COLOR_BACK="blue"
fi

if [ "$POWERLINE_SEC1_COLOR_FRONT" = "" ]; then
POWERLINE_SEC1_COLOR_FRONT="white"
fi

if [ "$POWERLINE_SEC1_COLOR_BACK" = "" ]; then
POWERLINE_SEC1_COLOR_BACK="black"
fi

if [ "$POWERLINE_SEC1_ROOT_COLOR_FRONT" = "" ]; then
POWERLINE_SEC1_ROOT_COLOR_FRONT="white"
fi

if [ "$POWERLINE_SEC1_ROOT_COLOR_BACK" = "" ]; then
POWERLINE_SEC1_ROOT_COLOR_BACK="red"
fi

ZSH_THEME_GIT_PROMPT_PREFIX=" \ue0a0 "
Expand All @@ -109,37 +149,38 @@ ZSH_THEME_GIT_PROMPT_DIVERGED=" ⬍"
# else
if [ "$POWERLINE_SHOW_GIT_ON_RIGHT" = "" ]; then
if [ "$POWERLINE_HIDE_GIT_PROMPT_STATUS" = "" ]; then
POWERLINE_GIT_INFO_LEFT=" %F{blue}%K{white}"$'\ue0b0'"%F{white}%F{black}%K{white}"$'$(git_prompt_info)$(git_prompt_status)%F{white}'
POWERLINE_GIT_INFO_LEFT=" %F{$POWERLINE_PATH_COLOR_BACK}%K{$POWERLINE_GIT_COLOR_BACK}"$'\ue0b0'"%F{$POWERLINE_GIT_COLOR_BACK}%F{$POWERLINE_GIT_COLOR_FRONT}%K{$POWERLINE_GIT_COLOR_BACK}"$'$(git_prompt_info)$(git_prompt_status)%F{$POWERLINE_GIT_COLOR_BACK}'
else
POWERLINE_GIT_INFO_LEFT=" %F{blue}%K{white}"$'\ue0b0'"%F{white}%F{black}%K{white}"$'$(git_prompt_info)%F{white}'
POWERLINE_GIT_INFO_LEFT=" %F{$POWERLINE_PATH_COLOR_BACK}%K{$POWERLINE_GIT_COLOR_BACK}"$'\ue0b0'"%F{$POWERLINE_GIT_COLOR_BACK}%F{$POWERLINE_GIT_COLOR_FRONT}%K{$POWERLINE_GIT_COLOR_BACK}"$'$(git_prompt_info)%F{$POWERLINE_GIT_COLOR_BACK}'
fi
POWERLINE_GIT_INFO_RIGHT=""
else
POWERLINE_GIT_INFO_LEFT=""
if [ "$POWERLINE_HIDE_GIT_PROMPT_STATUS" = "" ]; then
POWERLINE_GIT_INFO_RIGHT="%F{white}"$'\ue0b2'"%F{black}%K{white}"$'$(git_prompt_info)$(git_prompt_status)'" %K{white}"
POWERLINE_GIT_INFO_RIGHT="%F{$POWERLINE_GIT_COLOR_BACK}"$'\ue0b2'"%F{$POWERLINE_GIT_COLOR_FRONT}%K{$POWERLINE_GIT_COLOR_BACK}"$'$(git_prompt_info)$(git_prompt_status)'" %K{$POWERLINE_GIT_COLOR_BACK}"
else
POWERLINE_GIT_INFO_RIGHT="%F{white}"$'\ue0b2'"%F{black}%K{white}"$'$(git_prompt_info)'" %K{white}"
POWERLINE_GIT_INFO_RIGHT="%F{$POWERLINE_GIT_COLOR_BACK}"$'\ue0b2'"%F{$POWERLINE_GIT_COLOR_FRONT}%K{$POWERLINE_GIT_COLOR_BACK}"$'$(git_prompt_info)'" %K{$POWERLINE_GIT_COLOR_BACK}"
fi
fi
# fi

if [ $(id -u) -eq 0 ]; then
POWERLINE_SEC1_BG=%K{red}
POWERLINE_SEC1_FG=%F{red}
POWERLINE_SEC1_BG=%K{$POWERLINE_SEC1_ROOT_COLOR_BACK}
POWERLINE_SEC1_FG=%F{$POWERLINE_SEC1_ROOT_COLOR_BACK}
POWERLINE_SEC1_TXT=%F{$POWERLINE_SEC1_ROOT_COLOR_FRONT}
else
POWERLINE_SEC1_BG=%K{green}
POWERLINE_SEC1_FG=%F{green}
POWERLINE_SEC1_BG=%K{$POWERLINE_SEC1_COLOR_BACK}
POWERLINE_SEC1_FG=%F{$POWERLINE_SEC1_COLOR_BACK}
POWERLINE_SEC1_TXT=%F{$POWERLINE_SEC1_COLOR_FRONT}
fi
POWERLINE_SEC1_TXT=%F{black}
if [ "$POWERLINE_DETECT_SSH" != "" ]; then
if [ -n "$SSH_CLIENT" ]; then
POWERLINE_SEC1_BG=%K{red}
POWERLINE_SEC1_FG=%F{red}
POWERLINE_SEC1_TXT=%F{white}
fi
fi
PROMPT="$POWERLINE_SEC1_BG$POWERLINE_SEC1_TXT $POWERLINE_USER_NAME %k%f$POWERLINE_SEC1_FG%K{blue}"$'\ue0b0'"%k%f%F{white}%K{blue} "$POWERLINE_PATH"%F{blue}"$POWERLINE_GIT_INFO_LEFT" %k"$'\ue0b0'"%f "
PROMPT="$POWERLINE_SEC1_BG$POWERLINE_SEC1_TXT $POWERLINE_USER_NAME %k%f$POWERLINE_SEC1_FG%K{$POWERLINE_PATH_COLOR_BACK}"$'\ue0b0'"%k%f%F{$POWERLINE_PATH_COLOR_FRONT}%K{$POWERLINE_PATH_COLOR_BACK} "$POWERLINE_PATH"%F{$POWERLINE_PATH_COLOR_BACK}"$POWERLINE_GIT_INFO_LEFT" %k"$'\ue0b0'"%f "

if [ "$POWERLINE_NO_BLANK_LINE" = "" ]; then
PROMPT="
Expand All @@ -148,10 +189,12 @@ fi

if [ "$POWERLINE_DISABLE_RPROMPT" = "" ]; then
if [ "$POWERLINE_RIGHT_A" = "" ]; then
RPROMPT="$POWERLINE_GIT_INFO_RIGHT%F{white}"$'\ue0b2'"%k%F{black}%K{white} $POWERLINE_RIGHT_B %f%k"
RPROMPT="$POWERLINE_GIT_INFO_RIGHT%F{white}"$'\ue0b2'"%k%F{$POWERLINE_RIGHT_B_COLOR_FRONT}%K{$POWERLINE_RIGHT_B_COLOR_BACK} $POWERLINE_RIGHT_B %f%k"
elif [ "$POWERLINE_RIGHT_B" = "" ]; then
RPROMPT="$POWERLINE_GIT_INFO_RIGHT%F{white}"$'\ue0b2'"%k%F{$POWERLINE_RIGHT_A_COLOR_FRONT}%K{$POWERLINE_RIGHT_A_COLOR_BACK} $POWERLINE_RIGHT_A %f%k"
elif [ "$POWERLINE_RIGHT_ORDER" = "AB" ]; then
RPROMPT="$POWERLINE_GIT_INFO_RIGHT%f%F{$POWERLINE_RIGHT_A_COLOR_BACK}"$'\ue0b2'"%k%F{$POWERLINE_RIGHT_A_COLOR_FRONT}%K{$POWERLINE_RIGHT_A_COLOR_BACK} $POWERLINE_RIGHT_A %F{$POWERLINE_RIGHT_B_COLOR_BACK}"$'\ue0b2'"%f%k%K{$POWERLINE_RIGHT_B_COLOR_BACK}%F{$POWERLINE_RIGHT_B_COLOR_FRONT} $POWERLINE_RIGHT_B %f%k"
else
RPROMPT="$POWERLINE_GIT_INFO_RIGHT%F{white}"$'\ue0b2'"%k%F{black}%K{white} $POWERLINE_RIGHT_B %f%F{$POWERLINE_RIGHT_A_COLOR_BACK}"$'\ue0b2'"%f%k%K{$POWERLINE_RIGHT_A_COLOR_BACK}%F{$POWERLINE_RIGHT_A_COLOR_FRONT} $POWERLINE_RIGHT_A %f%k"
RPROMPT="$POWERLINE_GIT_INFO_RIGHT%F{$POWERLINE_RIGHT_B_COLOR_BACK}"$'\ue0b2'"%k%F{$POWERLINE_RIGHT_B_COLOR_FRONT}%K{$POWERLINE_RIGHT_B_COLOR_BACK} $POWERLINE_RIGHT_B %f%F{$POWERLINE_RIGHT_A_COLOR_BACK}"$'\ue0b2'"%f%k%K{$POWERLINE_RIGHT_A_COLOR_BACK}%F{$POWERLINE_RIGHT_A_COLOR_FRONT} $POWERLINE_RIGHT_A %f%k"
fi
fi