-
Notifications
You must be signed in to change notification settings - Fork 69
/
ansi-colors.sh
executable file
·92 lines (78 loc) · 2.26 KB
/
ansi-colors.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
set -e
printf " "
for background in $(seq 0 15)
do
printf " %2d " "${background}"
done
printf "\n"
for foreground in $(seq 0 15)
do
# Add each dim color right above corresponding normal color for easier visual comparisons
if ((foreground < 8))
then
printf "d%d:" "${foreground}"
printf "\x1B[2;$((foreground+30))m"
for background in $(seq 0 15)
do
printf "\x1B[48;5;${background}m"
printf " %2d " "${background}"
printf "\x1B[49m"
done
printf "\x1B[0m"
printf "\n"
fi
printf "%2d:" "${foreground}"
printf "\x1B[38;5;${foreground}m"
for background in $(seq 0 15)
do
printf "\x1B[48;5;${background}m"
printf " %2d " "${background}"
printf "\x1B[49m"
done
printf "\x1B[0m"
printf "\n"
done
# Underlines
CNAMES=("BLK" "RED" "GRN" "YEL" "BLU" "MAG" "CYN" "WHT")
printf "\033[1m" # bold
printf "\nUnderline With FG Colors:\n"
printf "\033[4m" # underline
for foreground in $(seq 0 7)
do
printf "\033[$((foreground+30))m ${CNAMES[$foreground]} "
done
printf "\x1B[24m\n" # no underline
printf "\nUnderline Styles And Colors:\n"
printf "\nFG: "
printf "\033[9mStrikeout\033[0m "
printf "\033[4mUnderline\033[0m "
printf "\033[4:2mDoubleUnderline\033[0m "
printf "\033[4:3mCurlyUnderline\033[0m "
printf "\033[4:4mDottedUnderline\033[0m "
printf "\033[4:5mDashedUnderline\033[0m "
printf "\n"
printf "INV: "
printf "\033[7m\033[9mStrikeout\033[0m "
printf "\033[7m\033[4mUnderline\033[0m "
printf "\033[7m\033[4:2mDoubleUnderline\033[0m "
printf "\033[7m\033[4:3mCurlyUnderline\033[0m "
printf "\033[7m\033[4:4mDottedUnderline\033[0m "
printf "\033[7m\033[4:5mDashedUnderline\033[0m "
printf "\n"
for line_color in $(seq 0 7)
do
printf "${CNAMES[$line_color]}: "
printf " "
printf "\033[58:5:"${line_color}m
printf "\033[4mUnderline\033[0m "
printf "\033[58:5:"${line_color}m
printf "\033[4:2mDoubleUnderline\033[0m "
printf "\033[58:5:"${line_color}m
printf "\033[4:3mCurlyUnderline\033[0m "
printf "\033[58:5:"${line_color}m
printf "\033[4:4mDottedUnderline\033[0m "
printf "\033[58:5:"${line_color}m
printf "\033[4:5mDashedUnderline\033[0m "
printf "\n"
done