Author: Kyle Fuller <kyle@fuller.li> 2024-12-23 22:32:41 +0000 +0000
Committer: Kyle Fuller <kyle@fuller.li> 2024-12-23 22:32:41 +0000 +0000
Commit: 644f7f0cffd3debcd5bf4348fb01bfb9d1a0200c
Parent: 44d3bd61a24f975f1c43bcbee9c2a730d591e793
feat(fish): add function to view ansi codes/colours
diff --git a/.config/fish/functions/colours.fish b/.config/fish/functions/colours.fish
new file mode 100644
index 0000000000000000000000000000000000000000..e3b9c6acd5b584ec58e74c77ee55b9183ab6db16
--- /dev/null
+++ b/.config/fish/functions/colours.fish
@@ -0,0 +1,56 @@
+function colours
+ echo "ANSI Codes"
+ echo "0: Reset"
+ echo -e "1: \033[1mBold\033[0m"
+ echo "30-37: Foreground colour"
+ echo "40-47: Background colour"
+ echo
+
+ for colour in (seq 0 7)
+ set foreground (math $colour + 30)
+ echo -ne "\033[$foreground""m"
+ echo -ne " $colour "
+ echo -ne "\e[0m "
+ end
+ echo
+ for colour in (seq 0 7)
+ set background (math $colour + 40)
+ echo -ne "\033[$background""m"
+ echo -ne " $colour "
+ echo -ne "\e[0m "
+ end
+ echo
+ echo
+
+ echo "Foreground (+30)"
+ for colour in (seq 0 7)
+ set foreground (math $colour + 30)
+ echo -ne "\033[$foreground""m"
+ echo -n "\033[$foreground""m"
+ echo -ne "\e[0m "
+ end
+ echo
+ echo
+
+ echo "Background (+40)"
+ for colour in (seq 0 7)
+ set background (math $colour + 40)
+ echo -ne "\033[$background""m"
+ echo -n "\033[$background""m"
+ echo -ne "\e[0m "
+ end
+ echo
+ echo
+
+ echo "Foreground and Background"
+ for foreground in (seq 30 37)
+ for background in (seq 40 47)
+ echo -ne "\033[$foreground;$background""m"
+ echo -n "\033[$foreground;$background""m"
+ echo -ne "\e[0m "
+ end
+
+ echo
+ end
+end
+