From 24213efe5e16f70f22beda34fca69975075f424c Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 19 Mar 2022 06:26:40 +0100 Subject: [PATCH] Add function that prints ANSI colour codes --- .config/zsh/functions/ansi-colours | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .config/zsh/functions/ansi-colours diff --git a/.config/zsh/functions/ansi-colours b/.config/zsh/functions/ansi-colours new file mode 100644 index 0000000..1342e64 --- /dev/null +++ b/.config/zsh/functions/ansi-colours @@ -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"