Add some more detail to Anatomy and add Regular Colors section

This commit is contained in:
The Magician 2023-11-05 10:31:42 +00:00
parent 46b3587585
commit 278b8f2e83
1 changed files with 20 additions and 1 deletions

View File

@ -66,7 +66,23 @@ section_anatomy() {
printf 'Overall, a control sequence is formatted like so:\n'
printf '0x1B + "[" + <zero or more numbers, separated by semicolons> + <a letter>\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'