feat manage script
This commit is contained in:
97
config/shared/bin/colortest
Executable file
97
config/shared/bin/colortest
Executable file
@@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Test black and white
|
||||
echo "=== Black and White ==="
|
||||
printf "Normal text\n"
|
||||
printf "\e[1mBold text\e[0m\n"
|
||||
printf "\e[7mReverse text\e[0m\n\n"
|
||||
|
||||
# Test 4-bit ANSI (16 colors)
|
||||
echo "=== 4-bit ANSI Colors (16 colors) ==="
|
||||
echo "Foreground colors:"
|
||||
for i in {30..37}; do
|
||||
printf "\e[${i}m\\e[${i}m\e[0m "
|
||||
done
|
||||
echo -e "\n"
|
||||
|
||||
echo "Background colors:"
|
||||
for i in {40..47}; do
|
||||
printf "\e[${i}m\\e[${i}m\e[0m "
|
||||
done
|
||||
echo -e "\n"
|
||||
|
||||
echo "Bright foreground colors:"
|
||||
for i in {90..97}; do
|
||||
printf "\e[${i}m\\e[${i}m\e[0m "
|
||||
done
|
||||
echo -e "\n"
|
||||
|
||||
echo "Bright background colors:"
|
||||
for i in {100..107}; do
|
||||
printf "\e[${i}m\\e[${i}m\e[0m "
|
||||
done
|
||||
echo -e "\n\n"
|
||||
|
||||
# Test 8-bit ANSI (256 colors)
|
||||
echo "=== 8-bit ANSI Colors (256 colors) ==="
|
||||
echo "16 System Colors:"
|
||||
for i in {0..15}; do
|
||||
printf "\e[48;5;${i}m \e[0m"
|
||||
if [ $((($i + 1) % 8)) == 0 ]; then
|
||||
echo
|
||||
fi
|
||||
done
|
||||
echo
|
||||
|
||||
echo "216 RGB Colors:"
|
||||
for i in {16..231}; do
|
||||
printf "\e[48;5;${i}m \e[0m"
|
||||
if [ $((($i - 15) % 36)) == 0 ]; then
|
||||
echo
|
||||
fi
|
||||
done
|
||||
echo
|
||||
|
||||
echo "24 Grayscale Colors:"
|
||||
for i in {232..255}; do
|
||||
printf "\e[48;5;${i}m \e[0m"
|
||||
if [ $((($i - 231) % 12)) == 0 ]; then
|
||||
echo
|
||||
fi
|
||||
done
|
||||
echo -e "\n"
|
||||
|
||||
# Test 24-bit true color
|
||||
echo "=== 24-bit True Color (16.7 million colors) ==="
|
||||
echo "RGB Color Gradient:"
|
||||
awk 'BEGIN{
|
||||
s="/\\";
|
||||
for (colnum = 0; colnum<77; colnum++) {
|
||||
r = 255-(colnum*255/76);
|
||||
g = (colnum*510/76);
|
||||
b = (colnum*255/76);
|
||||
if (g>255) g = 510-g;
|
||||
printf "\033[48;2;%d;%d;%dm", r,g,b;
|
||||
printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
|
||||
printf "%s\033[0m", substr(s,colnum%2+1,1);
|
||||
}
|
||||
printf "\n";
|
||||
}'
|
||||
|
||||
echo "RGB Color Bars:"
|
||||
for r in 0 127 255; do
|
||||
for g in 0 127 255; do
|
||||
for b in 0 127 255; do
|
||||
printf "\e[48;2;${r};${g};${b}m \e[0m"
|
||||
done
|
||||
printf " "
|
||||
done
|
||||
echo
|
||||
done
|
||||
echo
|
||||
|
||||
# Print terminal information
|
||||
echo "=== Terminal Information ==="
|
||||
echo "TERM: $TERM"
|
||||
echo "COLORTERM: $COLORTERM"
|
||||
echo "Reported colors (tput colors): $(tput colors)"
|
||||
Reference in New Issue
Block a user