Add section on inverted colors

This commit is contained in:
The Magician 2023-11-07 11:18:20 +00:00
parent ec60099157
commit cfb168958b
1 changed files with 22 additions and 7 deletions

View File

@ -356,7 +356,27 @@ section_dreaded_blinking_text_of_doom() {
section_inverse() { section_inverse() {
title "Code 7; Inverse" title "Code 7; Inverse"
printf 'TODO\n'
printf "The inverse attribute causes the foreground and background colors to be flipped.\n"
printf "Note that if you use \\\e[7m to flip the colors, you can't then use \\\e[7m to flip them back again. If you want to restore the original colors, you need to set them explicitly again.\n"
printf "The lack of this capability makes this attribute somewhat fiddly and superfluous; "
thebookofcolors
printf "' official recommendation is to always set foreground and background colors explicitly.\n"
newline
subtitle "A Table of Inverted Colors"
tableheader "Foreground"
printf " "
tableheader "Background"
newline
printf "\e[7;30m\\\e[7;30m Black\e[0m \e[7;40m\\\e[7;40m Black\e[0m\n"
printf "\e[7;31m\\\e[7;31m Red\e[0m \e[7;41m\\\e[7;41m Red\e[0m\n"
printf "\e[7;32m\\\e[7;32m Green\e[0m \e[7;42m\\\e[7;42m Green\e[0m\n"
printf "\e[7;33m\\\e[7;33m Brown\e[0m \e[7;43m\\\e[7;43m Brown\e[0m\n"
printf "\e[7;34m\\\e[7;34m Blue\e[0m \e[7;44m\\\e[7;44m Blue\e[0m\n"
printf "\e[7;35m\\\e[7;35m Purple\e[0m \e[7;45m\\\e[7;45m Purple\e[0m\n"
printf "\e[7;36m\\\e[7;36m Cyan\e[0m \e[7;46m\\\e[7;46m Cyan\e[0m\n"
printf "\e[7;37m\\\e[7;37m Light grey\e[0m \e[7;47m\\\e[7;47m Light grey\e[0m\n"
} }
section_using_escape_sequences_in_shell_prompt() { section_using_escape_sequences_in_shell_prompt() {
@ -447,12 +467,7 @@ main() {
#printf '\e[37m[37m Light grey\e[0m \e[47m[47m Light grey\e[0m\n' #printf '\e[37m[37m Light grey\e[0m \e[47m[47m Light grey\e[0m\n'
#printf '\n' #printf '\n'
#printf '\e[4;37m\e[1;37m1; (Boldness)\e[0m\n' #printf '\e[4;37m\e[1;37mBold Colors\e[0m\n'
#printf 'Note that some terminals use the "bold" attribute to display an alternate version of the color, e.g. a lighter or darker shade.\n'
#printf 'The canonical names for these alternate colors are what is displayed below.\n'
#printf 'Other terminals actually support displaying text with this attribute in a bold typeface.\n'
#printf '\n'
#printf '\e[4;37mForeground\e[0m \e[4;37mBackground\e[0m\n' #printf '\e[4;37mForeground\e[0m \e[4;37mBackground\e[0m\n'
#printf '\e[1;30m[1;30m Dark grey\e[0m \e[1;40m[1;40m Dark grey\e[0m\n' #printf '\e[1;30m[1;30m Dark grey\e[0m \e[1;40m[1;40m Dark grey\e[0m\n'
#printf '\e[1;31m[1;31m Light red\e[0m \e[1;41m[1;41m Light red\e[0m\n' #printf '\e[1;31m[1;31m Light red\e[0m \e[1;41m[1;41m Light red\e[0m\n'