Created
February 22, 2018 01:23
-
-
Save ironpinguin/0b7cf6965f4b78bbec97dd1516f6e85c to your computer and use it in GitHub Desktop.
Test the console Colors
This file contains hidden or 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
#!/usr/bin/env bash | |
fontColor=38 | |
backgroundColor=48 | |
colortable() { | |
base=$1 | |
count=0 | |
for colorCode in `seq -w 0 255`; do | |
count=$(($count + 1)) | |
echo -e -n "\033[${base};5;${colorCode}mCode ${colorCode} \033[0m" | |
if [[ $count -gt 7 ]]; then | |
echo | |
count=0 | |
fi | |
done | |
echo | |
} | |
colorrun() { | |
base=$1 | |
text=$2 | |
textLength=${#text} | |
for colorCode in `seq -w 0 255`; do | |
echo -e -n "\033[${base};5;${colorCode}m${text}\033[0m\033[${textLength}D" | |
sleep 0.05 | |
done | |
echo | |
} | |
rgbColor() { | |
base=$1 | |
count=0 | |
for rc in `seq -w 0 255`; do | |
for gc in `seq -w 0 255`; do | |
for bc in `seq -w 0 255`; do | |
count=$(($count + 1)) | |
echo -e -n "\033[${base};2;${rc};${gc};${bc}mRGB $rc:$gc:$bc \033[0m" | |
if [[ $count -gt 10 ]]; then | |
echo | |
count=0 | |
fi | |
done | |
done | |
done | |
echo | |
} | |
colortable $fontColor | |
colortable $backgroundColor | |
colorrun $fontColor "Hallo mein Freund" | |
colorrun $backgroundColor "Hallo mein Freund" | |
rgbColor $fontColor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment