-
Notifications
You must be signed in to change notification settings - Fork 0
/
skyline.sh
executable file
·65 lines (58 loc) · 2.52 KB
/
skyline.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
main() {
# Colors ===================================================================
# Iterate thru args, assign variables c0-c5
max_colors=6
for (( i = 0; i < $#; i++ )); do
eval "c${i}=\$(tput setaf \$$(( i + 1 )))"
if [[ $i == $max_colors ]]; then
break
fi
done
# If no colors were passed, default to blue and cyan
if [[ $# == 0 ]]; then
# Default: blue
c0="$(tput setaf 4)"
# Default: cyan
c1="$(tput setaf 6)"
# Update i so code below can fill in remaining colors
i=2
fi
# Handle any unset color vars
if (( i < max_colors )); then
for (( x = $i; x < $max_colors; x++ )); do
eval "c${x}=\$c$(( x % i ))"
done
fi
# Formatting ===============================================================
# Reset attributes
rst="$(tput sgr0)"
# Centering text
# Width of output
width=31
cols=$(tput cols)
# Padding
space_count=$(( ($cols/2) - ($width/2) ))
pad=$(printf '%*s' "$space_count" | tr ' ' ' ')
# Print Art ================================================================
cat << EOF
${pad} ${c2} ╷ ╷${rst}
${pad} ${c2} │ │${rst}
${pad} ${c2} ║ ║${rst}
${pad} ${c2} ║ ║${rst}
${pad} ${c2} ▐███▌${rst}
${pad} ${c2} ▐███▌ ${c4} │ │${rst}
${pad} ${c2} ▐███▌ ${c4} ╽ ╽${rst}
${pad} ${c2} ▐█████▌ ${c4} ┃ ┃${rst}
${pad} ${c2} ▐█████▌ ${c4} █████${rst}
${pad} ${c1} ▄██▄ ${c2} ▐█████▌ ${c4} █████${rst}
${pad} ${c1} ████ ${c2}▐███████▌ ${c4} █████${rst}
${pad} ${c1} ████ ${c2}▐███████▌ ${c4}▐█████▌${rst}
${pad} ${c1}▐██████${c2}▐███████▌ ${c4}▐█████▌${rst}
${pad} ${c1}▐██████${c2}▐████${c3}▐█████▌${c4}▐█████▌${rst}
${pad} ${c1}▐██████${c2}▐████${c3}▐█████▌${c4}███████${rst}
${pad}${c0}█████▌${c1}████${c2}▐████${c3}▐█████▌${c4}████${c5}▐████${rst}
${pad}${c0}█████▌${c1}████${c2}▐████${c3}▐█████▌${c4}████${c5}▐████${rst}
EOF
}
main "$@"