From 278b8f2e83d9b7480614a0fd6ea6b95ef9aeab54 Mon Sep 17 00:00:00 2001 From: The Magician Date: Sun, 5 Nov 2023 10:31:42 +0000 Subject: [PATCH] Add some more detail to Anatomy and add Regular Colors section --- thebookofcolors | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/thebookofcolors b/thebookofcolors index 9f9c88e..467d25d 100755 --- a/thebookofcolors +++ b/thebookofcolors @@ -66,7 +66,23 @@ section_anatomy() { printf 'Overall, a control sequence is formatted like so:\n' printf '0x1B + "[" + + \n' printf 'The CSI sequence we''ve gone over already. The easiest way to think about this is that the letter is the name of a function, and the semicolon-delimited numbers are the arguments to said function.\n' - printf 'By this model of thinking about escape sequences like function calls means you would read "\\e[0;1;34m" as m(0, 1, 34), and "\\e[A" as A().\n' + printf 'By this model of thinking about escape sequences like function calls means you would read "\\e[0;1;34m" as m(0, 1, 34), and "\\e[A" as A().' + newline 2 + printf 'The "m" function is the one we''re interested in. This is the "SGR", or "Select Graphics Rendition", code, and it tells the terminal to activate color and other text effects, which is what we''re interested in.\n' +} + +section_regular_colors() { + printf '\e[4;37m\e[1;37mRegular Colors\e[0m\n' + newline + + printf '\e[30m\\e[30m Black\e[0m\n' + printf '\e[31m\\e[31m Red\e[0m\n' + printf '\e[32m\\e[32m Green\e[0m\n' + printf '\e[33m\\e[33m Brown\e[0m\n' + printf '\e[34m\\e[34m Blue\e[0m\n' + printf '\e[35m\\e[35m Purple\e[0m\n' + printf '\e[36m\\e[36m Cyan\e[0m\n' + printf '\e[37m\\e[37m Light grey\e[0m\n' } main() { @@ -80,6 +96,9 @@ main() { newline section_anatomy + newline + + section_regular_colors #printf 'Use \\e (or \\033) followed by the control sequence specified next to activate that color.\n' #printf 'Use the reset sequence "[0m" to remove all set colors and styles.\n'