diff --git a/thebookofcolors b/thebookofcolors index 0e9de74..e0e7547 100755 --- a/thebookofcolors +++ b/thebookofcolors @@ -45,6 +45,17 @@ subtitle() { printf "\e[0m" } +italic() { + if test -z "$1"; then + printf "No title provided." 1>&2 + exit 1 + fi + + printf "\e[3;37m" + printf "$1" + printf "\e[0m" +} + section_introduction() { title "Introduction" @@ -80,8 +91,8 @@ section_anatomy() { printf "Overall, a control sequence is formatted like so:\n" newline - printf "\e[3m0x1B + [ + + \e[0m\n" - newline + italic "0x1B + [ + + " + newline 2 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" newline @@ -172,7 +183,13 @@ section_background_colors() { section_8bit_colors() { title "Codes 38;5 and 48;5; 8-bit (256) Colors" - printf 'TODO\n' + printf "When 8-bit color support started to become more common on graphics cards, some terminals added the ability to select from an extended 8-bit color palette, giving a total of 256 colors.\n" + printf "The syntax for selecting one of these colors is " + italic "\\\e[38;5;n" + printf " for foreground colors, or " + italic "\\\e[48;5;n" + printf " for background colors.\n" + } section_rgb_colors() {