Merge pull request #206 from dylanaraps/color_blocks

Fix color blocks in older systems.
This commit is contained in:
Dylan Araps 2016-03-31 20:13:52 +11:00
commit a506eb44a3
3 changed files with 7 additions and 6 deletions

View File

@ -11,4 +11,4 @@ before_install:
script:
- sudo make install
- time neofetch --test --ascii --color_blocks off --config off --ascii_distro travis
- time neofetch --test --ascii --config off --ascii_distro travis

1
1.6.md
View File

@ -39,6 +39,7 @@ long period of time like the CPU/GPU. \[1\]
- The default text colors now work on bright colorschemes. We no longer force<br \>
the color white, it's now based on your foreground color.
- Progress bars are now by default colored based on your distro's logo colors.
- Color blocks now work in older systems and Travis.
### Packages

View File

@ -1726,12 +1726,12 @@ getcols () {
if [ "$color_blocks" == "on" ]; then
printf "${padding}%s"
while [ $start -le $end ]; do
printf "\033[48;5;${start}m%${block_width}s"
case "$start" in
[0-6]) printf "\033[4${start}m%${block_width}s" ;;
7) printf "\033[4${start}m%${block_width}s\n${clear}${padding}" ;;
*) printf "\033[48;5;${start}m%${block_width}s" ;;
esac
start=$((start + 1))
# Split the blocks at 8 colors
[ $end -ge 9 ] && [ $start -eq 8 ] && \
printf "\n%s${clear}${padding}"
done
# Clear formatting