Add section on bold colors

This commit is contained in:
The Magician 2023-11-06 16:49:05 +00:00
parent 1086edea2d
commit 00aeb9db82
1 changed files with 26 additions and 3 deletions

View File

@ -34,6 +34,17 @@ title() {
printf "\e[0m\n"
}
subtitle() {
if test -z "$1"; then
printf "No title provided." 1>&2
exit 1
fi
printf "\e[4;37m"
printf "$1"
printf "\e[0m"
}
section_introduction() {
title "Introduction"
@ -144,10 +155,22 @@ section_background_colors() {
printf "Codes 40 through 47 are used to set the background color, as opposed to 30-37 being used to set the foreground (i.e. text) color.\n"
printf "40 through 47 select from the same eight-color palette as codes 30 through 37. Whether the \"boldness\" attribute will set the background color to the alternate \"bright\" color is implementation-dependent; both are shown here so you can see whether your terminal supports it.\n"
subtitle "Regular"
printf " "
subtitle "Bold"
newline
printf "\e[37;40m\\\e[40m Black\e[0m \e[1;37;40m\\\e[1;40m Dark grey\e[0m\n"
printf "\e[41m\\\e[41m Red\e[0m \e[1;41m\\\e[1;41m Light red\e[0m\n"
printf "\e[42m\\\e[42m Green\e[0m \e[1;42m\\\e[1;42m Light green\e[0m\n"
printf "\e[43m\\\e[43m Brown\e[0m \e[1;43m\\\e[1;43m Yellow\e[0m\n"
printf "\e[44m\\\e[44m Blue\e[0m \e[1;44m\\\e[1;44m Light blue\e[0m\n"
printf "\e[45m\\\e[45m Purple\e[0m \e[1;45m\\\e[1;45m Light purple\e[0m\n"
printf "\e[46m\\\e[46m Cyan\e[0m \e[1;46m\\\e[1;46m Light cyan\e[0m\n"
printf "\e[30;47m\\\e[47m Light grey\e[0m \e[1;30;47m\\\e[1;47m White\e[0m\n"
}
section_256_colors() {
title "Codes 38;5 and 48;5; 256 Colors"
section_8bit_colors() {
title "Codes 38;5 and 48;5; 8-bit (256) Colors"
printf 'TODO\n'
}
@ -229,7 +252,7 @@ main() {
section_background_colors
newline
section_256_colors
section_8bit_colors
newline
section_rgb_colors