diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2018-08-07 22:21:15 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2018-08-07 22:21:15 +0300 |
commit | ebbdb3c1c011a1f024e80b50c6b8b4a4fa5c46e2 (patch) | |
tree | dfb815497c5d29b5ac6450bb7a72c930cac2f0d9 /functions | |
parent | 345cf87b8f1f1c9b7e1396b7ab2fd9c4400a8cd0 (diff) |
Make purpose clear of backgroundColor and foregroundColor functions
The functions just start the colors, they do not end them. It seems
too much to have a function that terminates a color.
Diffstat (limited to 'functions')
-rwxr-xr-x | functions/colors.zsh | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/functions/colors.zsh b/functions/colors.zsh index 9309a225..b94258a5 100755 --- a/functions/colors.zsh +++ b/functions/colors.zsh @@ -50,20 +50,12 @@ function getColor() { # empty paramenter resets (stops) background color function backgroundColor() { - if [[ -z $1 ]]; then - echo -n "%k" - else - echo -n "%K{$(getColor $1)}" - fi + echo -n "%K{$(getColor $1)}" } # empty paramenter resets (stops) foreground color function foregroundColor() { - if [[ -z $1 ]]; then - echo -n "%f" - else - echo -n "%F{$(getColor $1)}" - fi + echo -n "%F{$(getColor $1)}" } # Get numerical color codes. That way we translate ANSI codes @@ -346,12 +338,12 @@ function getColorCode() { if [[ "$1" == "foreground" ]]; then # call via `getColorCode foreground` for i in "${(k@)codes}"; do - print -P "$(foregroundColor $i)$(getColor $i) - $i$(foregroundColor)" + print -P "$(foregroundColor $i)$(getColor $i) - $i%f" done elif [[ "$1" == "background" ]]; then # call via `getColorCode background` for i in "${(k@)codes}"; do - print -P "$(backgroundColor $i)$(getColor $i) - $i$(backgroundColor)" + print -P "$(backgroundColor $i)$(getColor $i) - $i%k" done else #[[ -n "$1" ]] bg="%K{$1}" || bg="%k" |