-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
get_terminal_height() { | ||
tput lines | ||
} | ||
|
||
get_terminal_width() { | ||
tput cols | ||
} | ||
draw_vertical_bars() { | ||
local terminal_height=$(get_terminal_height) | ||
local terminal_width=$(get_terminal_width) | ||
local bar_width=$((terminal_width / 8)) | ||
local -a bar_color=("\033[47m" "\033[43m" "\033[46m" "\033[42m" "\033[45m" "\033[41m" "\033[44m" "\033[40m") | ||
|
||
for ((i = 1; i <= terminal_height; i++)); do | ||
printf "$(printf '%s%%-'"${bar_width}"'s\\033[0m' "${bar_color[@]}")\n" " " " " " " " " " " " " " " " " | ||
done | ||
|
||
for kk in {7..0..-1}; do | ||
printf "${bar_color[$kk]}%-${bar_width}s\033[0m" " " | ||
done | ||
printf "\n${bar_color[6]}%-$((terminal_width - 6 ))s\033[0m\n" " " | ||
} | ||
draw_vertical_bars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env bash | ||
|
||
get_terminal_height() { | ||
tput lines | ||
} | ||
|
||
get_terminal_width() { | ||
tput cols | ||
} | ||
|
||
draw_vertical_bars() { | ||
local terminal_height=$(get_terminal_height) | ||
local terminal_width=$(get_terminal_width) | ||
local bar_width=$((terminal_width / 8)) | ||
local first_bar_color="\033[47m" | ||
local second_bar_color="\033[43m" | ||
local third_bar_color="\033[46m" | ||
local fourth_bar_color="\033[42m" | ||
local fifth_bar_color="\033[45m" | ||
local sixth_bar_color="\033[41m" | ||
local seventh_bar_color="\033[44m" | ||
local eight_bar_color="\033[40m" | ||
|
||
for ((i = 1; i <= terminal_height; i++)); do | ||
printf "${first_bar_color}%-${bar_width}s\033[0m" " " # print the main bars | ||
printf "${second_bar_color}%-${bar_width}s\033[0m" " " | ||
printf "${third_bar_color}%-${bar_width}s\033[0m" " " | ||
printf "${fourth_bar_color}%-${bar_width}s\033[0m" " " | ||
printf "${fifth_bar_color}%-${bar_width}s\033[0m" " " | ||
printf "${sixth_bar_color}%-${bar_width}s\033[0m" " " | ||
printf "${seventh_bar_color}%-${bar_width}s\033[0m" " " | ||
printf "${eight_bar_color}%-${bar_width}s\033[0m\n" " " | ||
done | ||
printf "${eight_bar_color}%-${bar_width}s\033[0m" " " # print the second row of color blocks | ||
printf "${seventh_bar_color}%-${bar_width}s\033[0m" " " | ||
printf "${sixth_bar_color}%-${bar_width}s\033[0m" " " | ||
printf "${fifth_bar_color}%-${bar_width}s\033[0m" " " | ||
printf "${fourth_bar_color}%-${bar_width}s\033[0m" " " | ||
printf "${third_bar_color}%-${bar_width}s\033[0m" " " | ||
printf "${second_bar_color}%-${bar_width}s\033[0m" " " | ||
printf "${first_bar_color}%-${bar_width}s\033[0m\n" " " | ||
printf "${seventh_bar_color}%-$((terminal_width - 6 ))s\033[0m\n" " " # Print the last full width bar | ||
} | ||
|
||
clear && tput reset | ||
draw_vertical_bars | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
cols=$(tput cols) | ||
lines=$(tput lines) | ||
barwidth=$(( cols / 8 )) | ||
colors=( 47 43 46 42 45 41 44 40 ) | ||
|
||
drawBarSegment() { | ||
printf '\033[%dm%*s' "$1" "$barwidth" " " | ||
} | ||
|
||
for (( line = 1; line < lines - 1; line++ )); do | ||
for color in "${colors[@]}"; do | ||
drawBarSegment $color | ||
done | ||
printf '%*s\n' "$(( cols % 8 ))" " " | ||
done | ||
|
||
for color in ${colors[@]}; do | ||
lastline="$(drawBarSegment $color)$lastline" | ||
done | ||
printf "%s%*s%s\033[m\n" "$lastline" "$(( cols % 8 ))" | ||
|