Merge pull request #368 from dylanaraps/blocks

Fix bugs with color blocks
This commit is contained in:
Dylan Araps 2016-10-16 10:51:05 +11:00 committed by GitHub
commit 87d6e7191c
2 changed files with 6 additions and 5 deletions

View file

@ -241,7 +241,7 @@ color_blocks="on"
# Color block width in spaces
# --block_width num
block_width=2
block_width=3
# Color block height in lines
# --block_height num

View file

@ -1901,14 +1901,15 @@ getbirthday() {
getcols() {
if [ "$color_blocks" == "on" ]; then
# Convert the width to space chars.
block_width="$(printf "%$((block_width-=1))s")"
block_width="$(printf "%${block_width}s")"
block_width="${block_width// /█}"
# Generate the string.
while [ $start -le $end ]; do
case "$start" in
[0-6]) blocks+="${reset}\033[3${start}m\033[4${start}m%${block_width}s" ;;
7) blocks+="${reset}\033[3${start}m\033[4${start}m%${block_width}s" ;;
*) blocks2+="\033[38;5;${start}m\033[48;5;${start}m%${block_width}s" ;;
[0-6]) blocks+="${reset}\033[3${start}m\033[4${start}m${block_width}" ;;
7) blocks+="${reset}\033[3${start}m\033[4${start}m${block_width}" ;;
*) blocks2+="\033[38;5;${start}m\033[48;5;${start}m${block_width}" ;;
esac
start="$((start+=1))"
done