Add section on RGB colors

This commit is contained in:
The Magician 2023-11-06 20:01:07 +00:00
parent 90ca8812a2
commit c97e3d6d65
1 changed files with 45 additions and 1 deletions

View File

@ -215,7 +215,51 @@ section_8bit_colors() {
section_rgb_colors() { section_rgb_colors() {
title "Codes 38;2 and 48;2; RGB Colors" title "Codes 38;2 and 48;2; RGB Colors"
printf 'TODO\n' printf "Again, as graphics hardware improved, some terminals added support for 24-bit color, or \"true color\".\n"
printf "These are the same RGB color codes used commonly in web development, where they're commonly shown in hexadecimal format.\n"
printf "The syntax for selecting a 24-bit color using ANSI escape codes is "
italic "\\\e[38;2;r;g;bm"
printf " for foreground colors, or "
italic "\\\e[48;2;r;g;bm"
printf " for background colors.\n"
printf "The "
italic "r"
printf ", "
italic "g"
printf ", and "
italic "b"
printf " values should be a number from 0 to 255, representing the intensity of that color channel."
printf "\\\e[38;2;0;0;0m is black, while \\\e[38;2;255;255;255 is white.\n"
newline
printf "Obviously, displaying a table of all 16 million available colors is impractical, so a small sampling giving a good representation of the variety of colors is given below.\n"
subtitle "A Sample of RGB Colors"
printf "\e[38;2;7;21;205m\\\e[38;2;7;21;205m\e[0m\n"
printf "\e[38;2;181;54;218m\\\e[38;2;181;54;218m\e[0m\n"
printf "\e[38;2;224;7;7m\\\e[38;2;224;7;7m\e[0m\n"
printf "\e[38;2;74;201;37m\\\e[38;2;74;201;37m\e[0m\n"
printf "\e[38;2;161;0;0m\\\e[38;2;161;0;0m\e[0m\n"
printf "\e[38;2;161;80;0m\\\e[38;2;161;80;0m\e[0m\n"
printf "\e[38;2;161;161;0m\\\e[38;2;161;161;0m\e[0m\n"
printf "\e[38;2;98;98;98m\\\e[38;2;98;98;98m\e[0m\n"
printf "\e[38;2;65;102;0m\\\e[38;2;65;102;0m\e[0m\n"
printf "\e[38;2;0;129;65m\\\e[38;2;0;129;65m\e[0m\n"
printf "\e[38;2;0;130;130m\\\e[38;2;0;130;130m\e[0m\n"
printf "\e[38;2;0;86;130m\\\e[38;2;0;86;130m\e[0m\n"
printf "\e[38;2;0;0;86m\\\e[38;2;0;0;86m\e[0m\n"
printf "\e[38;2;43;0;57m\\\e[38;2;43;0;57m\e[0m\n"
printf "\e[38;2;106;0;106m\\\e[38;2;106;0;106m\e[0m\n"
printf "\e[38;2;119;0;60m\\\e[38;2;119;0;60m\e[0m\n"
printf "\e[38;2;0;213;242m\\\e[38;2;0;213;242m\e[0m\n"
printf "\e[38;2;255;111;243m\\\e[38;2;255;111;243m\e[0m\n"
printf "\e[38;2;242;164;0m\\\e[38;2;242;164;0m\e[0m\n"
printf "\e[38;2;32;148;1m\\\e[38;2;32;148;1m\e[0m\n"
printf "\e[38;2;146;146;146m\\\e[38;2;146;146;146m\e[0m\n"
printf "\e[38;2;50;50;50m\\\e[38;2;50;50;50m\e[0m\n"
} }
section_bright_colors() { section_bright_colors() {