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: script:
- sudo make install - 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 default text colors now work on bright colorschemes. We no longer force<br \>
the color white, it's now based on your foreground color. 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. - Progress bars are now by default colored based on your distro's logo colors.
- Color blocks now work in older systems and Travis.
### Packages ### Packages

View file

@ -1726,12 +1726,12 @@ getcols () {
if [ "$color_blocks" == "on" ]; then if [ "$color_blocks" == "on" ]; then
printf "${padding}%s" printf "${padding}%s"
while [ $start -le $end ]; do 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)) start=$((start + 1))
# Split the blocks at 8 colors
[ $end -ge 9 ] && [ $start -eq 8 ] && \
printf "\n%s${clear}${padding}"
done done
# Clear formatting # Clear formatting