1
0
Fork 0

Add function that prints ANSI colour codes

This commit is contained in:
tastytea 2022-03-19 06:26:40 +01:00
parent c6f8269245
commit 24213efe5e
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
#!/usr/bin/env zsh
print "\e[1;97mClassic colours:\e[0m"
print "Regular Bold Underline Background"
for n in {30..37}; do
local nbg=$(( ${n} + 10 ))
print -c "\e[0;${n}m\\\e[0;${n}m\e[m" "\e[1;${n}m\\\e[1;${n}m\e[m" \
"\e[4;${n}m\\\e[4;${n}m\e[m" "\e[${nbg}m\\\e[${nbg}m\e[m"
done
print "\n\e[1;97mHigh intensity colours:\e[0m"
print "Regular Bold Underline Background"
for n in {90..97}; do
local nbg=$(( ${n} + 10 ))
print -cn "\e[0;${n}m\\\e[0;${n}m\e[m" "\e[1;${n}m\\\e[1;${n}m\e[m" \
"\e[4;${n}m\\\e[4;${n}m\e[m" "\e[${nbg}m\\\e[${nbg}m\e[m"
done
print "\n\e[1;97m256 colour pallette:\e[0m"
local -a colours
for n in {0..255}; do
colours+="\e[38;5;${n}m\\\e[38;5;${n}m\e[0m"
done
print -c ${colours}
print "\e[1;97mReset: \e[0m\\\e[0m"