From c51f7cdac39f5887d2bda738d54a957e7da9a9ef Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 27 Mar 2016 20:46:05 +1100 Subject: [PATCH 1/6] Color progress bars based on distro logo colors --- neofetch | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index e005978d..11e1f58f 100755 --- a/neofetch +++ b/neofetch @@ -279,9 +279,11 @@ progress_char="━" progress_length="15" # Progress bar colors +# When set to distro, uses your distro's logo colors +# Takes: num, "distro" # --progress_colors col col -progress_color_elapsed="6" -progress_color_total="8" +progress_color_elapsed="distro" +progress_color_total="distro" # Customize how the info is displayed. # bar: Only the progress bar is displayed. @@ -2341,6 +2343,12 @@ setcolors () { colon_color="\033[3${colors[4]}m" info_color="\033[3${colors[5]}m" fi + + [ "$progress_color_elapsed" == "distro" ] && \ + progress_color_elapsed="7" + + [ "$progress_color_total" == "distro" ] && \ + progress_color_total="$2" } color () { @@ -2452,8 +2460,8 @@ bar() { total=$(printf %"$((progress_length - elapsed))"s) # Set the colors and swap the spaces for $progress_char - bar="\033[38;5;${progress_color_elapsed}m${prog// /$progress_char}" - bar+="\033[38;5;${progress_color_total}m${total// /$progress_char}" + bar="\033[0m\033[3${progress_color_elapsed}m${prog// /$progress_char}" + bar+="\033[0m\033[3${progress_color_total}m${total// /$progress_char}" printf "%b%s\n" "${bar}${clear}" } From 3ac52b171709eeb1773cc4290c44e9505dfd5966 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 27 Mar 2016 20:49:06 +1100 Subject: [PATCH 2/6] Don't let total bar be white --- neofetch | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 11e1f58f..01e5f680 100755 --- a/neofetch +++ b/neofetch @@ -2347,8 +2347,10 @@ setcolors () { [ "$progress_color_elapsed" == "distro" ] && \ progress_color_elapsed="7" - [ "$progress_color_total" == "distro" ] && \ + if [ "$progress_color_total" == "distro" ]; then progress_color_total="$2" + [ "$2" == 7 ] && progress_color_total="${1}" + fi } color () { From 951ed1169cf621daf1b4f601e600091a587eb979 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 27 Mar 2016 20:53:46 +1100 Subject: [PATCH 3/6] Use '' instead of '' for coloring since '' has a lower chance of being white --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 01e5f680..f9c0f7d8 100755 --- a/neofetch +++ b/neofetch @@ -2348,8 +2348,8 @@ setcolors () { progress_color_elapsed="7" if [ "$progress_color_total" == "distro" ]; then - progress_color_total="$2" - [ "$2" == 7 ] && progress_color_total="${1}" + progress_color_total="$1" + [ "$1" == 7 ] && progress_color_total="${2}" fi } From 0c4608a26805e07774e4ca84f20ee0390c959638 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 27 Mar 2016 21:01:47 +1100 Subject: [PATCH 4/6] Update config file --- config/config | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config/config b/config/config index bb829200..ed283210 100644 --- a/config/config +++ b/config/config @@ -257,9 +257,11 @@ progress_char="━" progress_length="15" # Progress bar colors +# When set to distro, uses your distro's logo colors +# Takes: num, "distro" # --progress_colors col col -progress_color_elapsed="6" -progress_color_total="8" +progress_color_elapsed="distro" +progress_color_total="distro" # Customize how the info is displayed. # bar: Only the progress bar is displayed. From 35d120c25d510afd97aeb2af14e7240e90945c89 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 27 Mar 2016 21:17:02 +1100 Subject: [PATCH 5/6] Restrict progress bar colors to darker shades' --- neofetch | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index f9c0f7d8..6873448b 100755 --- a/neofetch +++ b/neofetch @@ -2349,7 +2349,9 @@ setcolors () { if [ "$progress_color_total" == "distro" ]; then progress_color_total="$1" - [ "$1" == 7 ] && progress_color_total="${2}" + case "$1" in + 7 | 3 | 6) progress_color_total="${2}" ;; + esac fi } From a6bcaab30a5be8e4253542c619fdfe6099b0d8ff Mon Sep 17 00:00:00 2001 From: Dylan Date: Sun, 27 Mar 2016 21:42:26 +1100 Subject: [PATCH 6/6] Remove highlight reset from progress bars and rebase --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 6873448b..8ef16b08 100755 --- a/neofetch +++ b/neofetch @@ -2464,8 +2464,8 @@ bar() { total=$(printf %"$((progress_length - elapsed))"s) # Set the colors and swap the spaces for $progress_char - bar="\033[0m\033[3${progress_color_elapsed}m${prog// /$progress_char}" - bar+="\033[0m\033[3${progress_color_total}m${total// /$progress_char}" + bar="\033[3${progress_color_elapsed}m${prog// /$progress_char}" + bar+="\033[3${progress_color_total}m${total// /$progress_char}" printf "%b%s\n" "${bar}${clear}" }