-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdisplay_colors.sh
More file actions
executable file
·45 lines (39 loc) · 1.21 KB
/
display_colors.sh
File metadata and controls
executable file
·45 lines (39 loc) · 1.21 KB
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
#!/bin/bash
# Display ANSI color codes
echo "ANSI Color Codes"
echo "================"
# Basic colors (0-7)
echo -e "\nBasic colors (0-7):"
for i in {0..7}; do
echo -e "\e[3${i}m3${i}: Foreground\e[0m \e[4${i}m4${i}: Background\e[0m"
done
# Bright colors (0-7)
echo -e "\nBright colors (90-97, 100-107):"
for i in {0..7}; do
echo -e "\e[9${i}m9${i}: Foreground\e[0m \e[10${i}m10${i}: Background\e[0m"
done
# Text attributes
echo -e "\nText attributes:"
echo -e "\e[0m0: Reset\e[0m"
echo -e "\e[1m1: Bold\e[0m"
echo -e "\e[2m2: Dim\e[0m"
echo -e "\e[3m3: Italic\e[0m"
echo -e "\e[4m4: Underline\e[0m"
echo -e "\e[5m5: Blink\e[0m"
echo -e "\e[7m7: Reverse\e[0m"
echo -e "\e[8m8: Hidden\e[0m (hidden)"
echo -e "\e[9m9: Strikethrough\e[0m"
# 256 colors
echo -e "\n256 colors (16-255):"
for i in {16..255}; do
printf "\e[38;5;%sm %3s \e[0m" $i $i
[ $(( (i-15) % 6)) -eq 0 ] && echo
done
# RGB colors example
echo -e "\nRGB color examples:"
echo -e "\e[38;2;255;0;0mRed (255,0,0)\e[0m"
echo -e "\e[38;2;0;255;0mGreen (0,255,0)\e[0m"
echo -e "\e[38;2;0;0;255mBlue (0,0,255)\e[0m"
echo -e "\e[38;2;255;255;0mYellow (255,255,0)\e[0m"
echo -e "\e[38;2;0;255;255mCyan (0,255,255)\e[0m"
echo -e "\e[38;2;255;0;255mMagenta (255,0,255)\e[0m"