Add italic function

This commit is contained in:
The Magician 2023-11-06 16:55:06 +00:00
parent 00aeb9db82
commit 1ce29a6a3a
1 changed files with 20 additions and 3 deletions

View File

@ -45,6 +45,17 @@ subtitle() {
printf "\e[0m" 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() { section_introduction() {
title "Introduction" title "Introduction"
@ -80,8 +91,8 @@ section_anatomy() {
printf "Overall, a control sequence is formatted like so:\n" printf "Overall, a control sequence is formatted like so:\n"
newline newline
printf "\e[3m0x1B + [ + <zero or more numbers, separated by semicolons> + <a letter>\e[0m\n" italic "0x1B + [ + <zero or more numbers, separated by semicolons> + <a letter>"
newline 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 "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().\n"
newline newline
@ -172,7 +183,13 @@ section_background_colors() {
section_8bit_colors() { section_8bit_colors() {
title "Codes 38;5 and 48;5; 8-bit (256) 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() { section_rgb_colors() {