478 lines
19 KiB
Bash
Executable File
478 lines
19 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
thebookofcolors() {
|
|
printf "\e[4;7;36m"
|
|
if test -z "$1"; then
|
|
printf "The Book of Colors"
|
|
else
|
|
printf "$1"
|
|
fi
|
|
printf "\e[0m"
|
|
}
|
|
|
|
newline() {
|
|
if test -z "$1"; then
|
|
printf "\n"
|
|
return
|
|
fi
|
|
|
|
for i in $(seq 1 $1); do
|
|
printf "\n"
|
|
done
|
|
}
|
|
|
|
title() {
|
|
if test -z "$1"; then
|
|
printf "No title provided." 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
printf "\e[1;4;37m"
|
|
printf "$1"
|
|
printf "\e[0m\n"
|
|
}
|
|
|
|
subtitle() {
|
|
if test -z "$1"; then
|
|
printf "No subtitle provided." 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
printf "\e[4;37m"
|
|
printf "$1"
|
|
printf "\e[0m"
|
|
if test -z "$2"; then printf "\n"; fi
|
|
}
|
|
|
|
tableheader() {
|
|
subtitle "$1" "noreturn"
|
|
}
|
|
|
|
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"
|
|
|
|
thebookofcolors
|
|
printf " is an in-terminal manual on ANSI escape codes, or \"color codes\", for use in terminal emulators.\n"
|
|
printf "Examples are given not only in written form, but \"practical\" form -- every escape code and option described in "
|
|
thebookofcolors
|
|
printf " is used in "
|
|
thebookofcolors "The Book"
|
|
printf " itself.\n"
|
|
}
|
|
|
|
section_disclaimers() {
|
|
title "Disclaimers"
|
|
|
|
thebookofcolors
|
|
printf " is open-source software and is provided as-is with NO WARRANTY under applicable law.\n"
|
|
printf "If any escape codes persist to your terminal session after viewing "
|
|
thebookofcolors "The Book"
|
|
printf ", use the \`reset\` command to restore your terminal.\n"
|
|
printf "If you believe you have found a bug, please open an issue on the repository, which can be found at <REPOSITORY_URL_GOES_HERE>.\n"
|
|
printf "If you have a fix for said bug, please submit a pull request instead.\n"
|
|
}
|
|
|
|
section_anatomy() {
|
|
title "Anatomy of an ANSI Escape Code"
|
|
|
|
printf "Escape codes begin with \`\\e\`, \`\\033\`, or \`\\x1b\`. These are all three different escape sequences which insert the ASCII character 27, or ESC. (This is why they're called ANSI \"escape\" codes, because they begin with a literal escape character). The syntax \`\\e\` is used throughout "
|
|
thebookofcolors
|
|
printf ". The choice is arbitrary, but consistent throughout.\n"
|
|
printf "The next character is a \`[\`. This combination of characters, an escape followed by an open bracket, is called the \"CSI\", or \"Control Sequence Introducer\", which indicates the start of a control code.\n"
|
|
newline
|
|
|
|
printf "Overall, a control sequence is formatted like so:\n"
|
|
newline
|
|
italic "0x1B + [ + <zero or more numbers, separated by semicolons> + <a letter>"
|
|
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
|
|
|
|
printf "The \"m\" function is the one we're interested in. This is the \"SGR\", or \"Select Graphics Rendition\", code, and it tells the terminal to activate color and other text effects, which is what we're interested in.\n"
|
|
}
|
|
|
|
section_regular_colors() {
|
|
title "Codes 30-37; Regular Foreground Colors"
|
|
|
|
printf "Originally, hardware video terminals only had support for eight standard colors.\n"
|
|
printf "The SGR control codes 30 through 37 are used to set the foreground color to each of these colors.\n"
|
|
printf "These colors and their respective escape codes are shown in the following table:\n"
|
|
newline
|
|
|
|
printf "\e[30;47m\\\e[30m Black\e[0m (shown on light grey background to aid visibility)\n"
|
|
printf "\e[31m\\\e[31m Red\e[0m\n"
|
|
printf "\e[32m\\\e[32m Green\e[0m\n"
|
|
printf "\e[33m\\\e[33m Brown\e[0m\n"
|
|
printf "\e[34m\\\e[34m Blue\e[0m\n"
|
|
printf "\e[35m\\\e[35m Purple\e[0m\n"
|
|
printf "\e[36m\\\e[36m Cyan\e[0m\n"
|
|
printf "\e[37m\\\e[37;40m Light grey (shown on black background to aid visibility)\e[0m\n"
|
|
}
|
|
|
|
section_notes_on_names() {
|
|
title "Notes on the Names of Colors"
|
|
|
|
printf "It's possible that the actual colors you see may not match the names of the colors printed in the tables found throughout "
|
|
thebookofcolors
|
|
printf ".\n"
|
|
printf "This is because the colors displayed for each color code are dependent on both terminal implementation and individual user configuration, whereas the different color values have hardcoded names.\n"
|
|
printf "Depending on your terminal and individual configurations, what you see may vary mildly or wildly from what "
|
|
thebookofcolors "The Book"
|
|
printf " lists as the name of each color.\n"
|
|
thebookofcolors
|
|
printf " uses the canonical color names throughout, since there's no way to know what any individual reader will see.\n"
|
|
newline
|
|
|
|
printf "The colors chosen to be part of the standard palette may seem to be arbitrary (and arbitrarily ordered), but there is a logic to it -- after \e[30;47mblack\e[0m, \e[31mred\e[0m is first for highlighting error conditions, then \e[32mgreen\e[0m for successes, \e[33mbrown\e[0m for warnings, \e[34mblue\e[0m for information, and \e[35mpurple\e[0m and \e[36mcyan\e[0m for more obscure conditions.\n"
|
|
|
|
}
|
|
|
|
section_reset() {
|
|
title "Code 0; Reset"
|
|
|
|
printf "The SGR code \"0\" means \"reset\". This will restore all previously set colors and styles to the terminal's default values.\n"
|
|
printf "This is used often to end a section of styling, because codes continue indefinitely after they've been set.\n"
|
|
printf "For example, if you use \e[32m\\\e[32m to set the text to green, then that style will persist until the color is either changed again with another foreground color code, or reset with \e[0m\\\e[0m.\n"
|
|
}
|
|
|
|
section_bold_colors() {
|
|
title "Code 1; Bold Color"
|
|
|
|
printf "The SGR attribute \`1\` enables \"boldness\".\n"
|
|
printf "The result of using this attribute is highly implementation-dependent -- depending on the terminal used, this can either change the color to a \"bright\" version of the standard color, change the font face to bold, or both.\n"
|
|
printf "Here is a table of the colors with the boldness attribute enabled, along with their alternate names:\n"
|
|
|
|
printf "\e[1;30;47m\\\e[1;30m Dark grey\e[0m (shown on light grey)\n"
|
|
printf "\e[1;31m\\\e[1;31m Light red\e[0m\n"
|
|
printf "\e[1;32m\\\e[1;32m Light green\e[0m\n"
|
|
printf "\e[1;33m\\\e[1;33m Yellow\e[0m\n"
|
|
printf "\e[1;34m\\\e[1;34m Light blue\e[0m\n"
|
|
printf "\e[1;35m\\\e[1;35m Light purple\e[0m\n"
|
|
printf "\e[1;36m\\\e[1;36m Light cyan\e[0m\n"
|
|
printf "\e[1;37;40m\\\e[1;37m White (shown on black)\e[0m\n"
|
|
}
|
|
|
|
section_background_colors() {
|
|
title "Codes 40-47; 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_8bit_colors() {
|
|
title "Codes 38;5 and 48;5; 8-bit (256) Colors"
|
|
|
|
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"
|
|
printf "The value chosen for "
|
|
italic "n"
|
|
printf " determines which color is selected. See the information in the following two subsections to see the range of colors available.\n"
|
|
newline
|
|
|
|
subtitle "Ranges of Available Colors"
|
|
printf " 0- 7: Standard colors (the same as \\\e[30m through \\\e[37m)\n"
|
|
printf " 8- 15: Bright colors (the same as \\\e[90m through \\\e[97m)\n"
|
|
printf " 16-231: A 6x6x6 cube of RGB colors\n"
|
|
printf "232-255: Grayscale from light to dark in 24 increments\n"
|
|
newline
|
|
|
|
subtitle "A Table of Available Colors"
|
|
for i in $(seq 0 255); do
|
|
if test "$(echo $i % 8 | bc)" = "0" -a "$i" != "0"; then
|
|
printf "\n"
|
|
fi
|
|
|
|
printf "\e[38;5;${i}m\\\e[38;5;%-3d\e[0m " "$i"
|
|
done
|
|
newline
|
|
}
|
|
|
|
section_rgb_colors() {
|
|
title "Codes 38;2 and 48;2; RGB Colors"
|
|
|
|
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() {
|
|
title "Codes 90-97 and 100-107; Bright Colors"
|
|
|
|
printf "Codes 90 through 97 and 100 through 107 are used to access the alternate \"bright\" color palette.\n"
|
|
printf "This allows you to access these colors regardless of whether the \"boldness\" attribute causes these colors to be displayed in your particular terminal.\n"
|
|
printf "Codes 90 through 97 set the foreground color, whereas codes 100 through 107 set the background color.\n"
|
|
newline
|
|
|
|
subtitle "A Table of Bright Colors"
|
|
tableheader "Foreground"
|
|
printf " "
|
|
tableheader "Background"
|
|
newline
|
|
printf "\e[90m\\\e[90m Dark grey\e[0m \e[100m\\\e[100m Dark grey\e[0m\n"
|
|
printf "\e[91m\\\e[91m Light red\e[0m \e[101m\\\e[101m Light red\e[0m\n"
|
|
printf "\e[92m\\\e[92m Light green\e[0m \e[102m\\\e[102m Light green\e[0m\n"
|
|
printf "\e[93m\\\e[93m Yellow\e[0m \e[103m\\\e[103m Yellow\e[0m\n"
|
|
printf "\e[94m\\\e[94m Light blue\e[0m \e[104m\\\e[104m Light blue\e[0m\n"
|
|
printf "\e[95m\\\e[95m Light purple\e[0m \e[105m\\\e[105m Light purple\e[0m\n"
|
|
printf "\e[96m\\\e[96m Light cyan\e[0m \e[106m\\\e[106m Light cyan\e[0m\n"
|
|
printf "\e[97m\\\e[97m White\e[0m \e[107m\\\e[107m White\e[0m\n"
|
|
}
|
|
|
|
section_italics() {
|
|
title "Code 3; Italics"
|
|
|
|
printf 'TODO\n'
|
|
}
|
|
|
|
section_underline() {
|
|
title "Code 4; Underline"
|
|
|
|
printf 'TODO\n'
|
|
}
|
|
|
|
section_dreaded_blinking_text_of_doom() {
|
|
title "Codes 5 and 6; Blinking"
|
|
printf 'TODO\n'
|
|
}
|
|
|
|
section_inverse() {
|
|
title "Code 7; Inverse"
|
|
printf 'TODO\n'
|
|
}
|
|
|
|
section_using_escape_sequences_in_shell_prompt() {
|
|
title "Using Escape Sequences in Shell Prompts"
|
|
printf 'TODO\n'
|
|
}
|
|
|
|
section_table_of_all_sgr_commands() {
|
|
title "Table of All SGR Commands"
|
|
printf 'TODO\n'
|
|
}
|
|
|
|
section_credits() {
|
|
title "Credits"
|
|
printf 'TODO\n'
|
|
}
|
|
|
|
main() {
|
|
thebookofcolors
|
|
newline 2
|
|
|
|
section_introduction
|
|
newline
|
|
|
|
section_disclaimers
|
|
newline
|
|
|
|
section_anatomy
|
|
newline
|
|
|
|
section_regular_colors
|
|
newline
|
|
|
|
section_notes_on_names
|
|
newline
|
|
|
|
section_reset
|
|
newline
|
|
|
|
section_bold_colors
|
|
newline
|
|
|
|
section_background_colors
|
|
newline
|
|
|
|
section_8bit_colors
|
|
newline
|
|
|
|
section_rgb_colors
|
|
newline
|
|
|
|
section_bright_colors
|
|
newline
|
|
|
|
section_italics
|
|
newline
|
|
|
|
section_underline
|
|
newline
|
|
|
|
section_dreaded_blinking_text_of_doom
|
|
newline
|
|
|
|
section_inverse
|
|
newline
|
|
|
|
section_using_escape_sequences_in_shell_prompt
|
|
newline
|
|
|
|
section_table_of_all_sgr_commands
|
|
newline
|
|
|
|
section_credits
|
|
newline
|
|
|
|
#printf 'When using these sequences in a Bash prompt (e.g. $PS1), be sure to surround the whole escape sequence with escaped brackets to prevent issues with Bash miscounting the number of characters in a line. For example: `export PS1=''\[\\e[36m\]\u@\h \$\[\\e[0m\]''` would create a cyan-colored prompt string.\n'
|
|
#printf '\n'
|
|
#
|
|
#printf '\e[4;37m\e[1;37mRegular Colors\e[0m\n'
|
|
#printf '\e[4;37mForeground\e[0m \e[4;37mBackground\e[0m\n'
|
|
#printf '\e[30m[30m Black\e[0m \e[40m[40m Black\e[0m\n'
|
|
#printf '\e[31m[31m Red\e[0m \e[41m[41m Red\e[0m\n'
|
|
#printf '\e[32m[32m Green\e[0m \e[42m[42m Green\e[0m\n'
|
|
#printf '\e[33m[33m Brown\e[0m \e[43m[43m Brown\e[0m\n'
|
|
#printf '\e[34m[34m Blue\e[0m \e[44m[44m Blue\e[0m\n'
|
|
#printf '\e[35m[35m Purple\e[0m \e[45m[45m Purple\e[0m\n'
|
|
#printf '\e[36m[36m Cyan\e[0m \e[46m[46m Cyan\e[0m\n'
|
|
#printf '\e[37m[37m Light grey\e[0m \e[47m[47m Light grey\e[0m\n'
|
|
#printf '\n'
|
|
|
|
#printf '\e[4;37m\e[1;37m1; (Boldness)\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[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;32m[1;32m Light green\e[0m \e[1;42m[1;42m Light green\e[0m\n'
|
|
#printf '\e[1;33m[1;33m Yellow\e[0m \e[1;43m[1;43m Yellow\e[0m\n'
|
|
#printf '\e[1;34m[1;34m Light blue\e[0m \e[1;44m[1;44m Light blue\e[0m\n'
|
|
#printf '\e[1;35m[1;35m Light purple\e[0m \e[1;45m[1;45m Light purple\e[0m\n'
|
|
#printf '\e[1;36m[1;36m Light cyan\e[0m \e[1;46m[1;46m Light cyan\e[0m\n'
|
|
#printf '\e[1;37m[1;37m White\e[0m \e[1;47m[1;47m White\e[0m\n'
|
|
#printf '\n'
|
|
|
|
#printf '\e[4;37m\e[1;37m2; (Test)\e[0m\n'
|
|
#printf '\e[2;34m[2;34m Light blue\e[0m \e[2;44m[2;44m Light blue\e[0m\n'
|
|
#printf '\n'
|
|
|
|
#printf '\e[4;37m\e[1;37m3; (Test)\e[0m\n'
|
|
#printf '\e[3;34m[3;34m Light blue\e[0m \e[3;44m[3;44m Light blue\e[0m\n'
|
|
#printf '\n'
|
|
|
|
#printf '\e[4;37m\e[1;37m4; (Underscore)\e[0m\n'
|
|
#printf 'This attribute displays text with an underline.\n'
|
|
#printf 'If the underline is always displayed in the foreground color. See the table below for more detail.\n'
|
|
#printf '\n'
|
|
#printf '\e[4;37mForeground\e[0m \e[4;37mBackground\e[0m\n'
|
|
#printf '\e[4;30m[4;30m Black\e[0m \e[4;40m[4;40m Black\e[0m\n'
|
|
#printf '\e[4;31m[4;31m Red\e[0m \e[4;41m[4;41m Red\e[0m\n'
|
|
#printf '\e[4;32m[4;32m Green\e[0m \e[4;42m[4;42m Green\e[0m\n'
|
|
#printf '\e[4;33m[4;33m Brown\e[0m \e[4;43m[4;43m Brown\e[0m\n'
|
|
#printf '\e[4;34m[4;34m Blue\e[0m \e[4;44m[4;44m Blue\e[0m\n'
|
|
#printf '\e[4;35m[4;35m Purple\e[0m \e[4;45m[4;45m Purple\e[0m\n'
|
|
#printf '\e[4;36m[4;36m Cyan\e[0m \e[4;46m[4;46m Cyan\e[0m\n'
|
|
#printf '\e[4;37m[4;37m Light grey\e[0m \e[4;47m[4;47m Light grey\e[0m\n'
|
|
#printf '\n'
|
|
|
|
#printf '\e[4;37m\e[1;37m5; (Blinkentext)\e[0m\n'
|
|
#printf 'Also known as the dreaded blinking text of doom.\n'
|
|
#printf 'Causes text to blink. Some terminal emulators refuse to honor this attribute as a matter of good taste, although there are some semi-legitimate uses for it -- the `ls` program, for example, can be configured to cause listings of broken symlinks to blink.\n'
|
|
#printf 'Note that even if the blinking attribute is set on a background color, it''s always the text that blinks, not the background.\n'
|
|
#printf '\n'
|
|
#printf '\e[4;37mForeground\e[0m \e[4;37mBackground\e[0m\n'
|
|
#printf '\e[5;30m[5;30m Black\e[0m \e[5;40m[5;40m Black\e[0m\n'
|
|
#printf '\e[5;31m[5;31m Red\e[0m \e[5;41m[5;41m Red\e[0m\n'
|
|
#printf '\e[5;32m[5;32m Green\e[0m \e[5;42m[5;42m Green\e[0m\n'
|
|
#printf '\e[5;33m[5;33m Brown\e[0m \e[5;43m[5;43m Brown\e[0m\n'
|
|
#printf '\e[5;34m[5;34m Blue\e[0m \e[5;44m[5;44m Blue\e[0m\n'
|
|
#printf '\e[5;35m[5;35m Purple\e[0m \e[5;45m[5;45m Purple\e[0m\n'
|
|
#printf '\e[5;36m[5;36m Cyan\e[0m \e[5;46m[5;46m Cyan\e[0m\n'
|
|
#printf '\e[5;37m[5;37m Light grey\e[0m \e[5;47m[5;47m Light grey\e[0m\n'
|
|
#printf '\n'
|
|
|
|
#printf '\e[4;37m\e[1;37m7; (Inverse)\e[0m\n'
|
|
#printf 'Causes the foreground and background text to be flipped.\n'
|
|
#printf 'This is mostly a convenient shorthand for avoiding setting the foreground and background text simultaneously when you want one to be the default of the other.\n'
|
|
#printf '\n'
|
|
#printf '\e[4;37mForeground\e[0m \e[4;37mBackground\e[0m\n'
|
|
#printf '\e[7;30m[7;30m Black\e[0m \e[7;40m[7;40m Black\e[0m\n'
|
|
#printf '\e[7;31m[7;31m Red\e[0m \e[7;41m[7;41m Red\e[0m\n'
|
|
#printf '\e[7;32m[7;32m Green\e[0m \e[7;42m[7;42m Green\e[0m\n'
|
|
#printf '\e[7;33m[7;33m Brown\e[0m \e[7;43m[7;43m Brown\e[0m\n'
|
|
#printf '\e[7;34m[7;34m Blue\e[0m \e[7;44m[7;44m Blue\e[0m\n'
|
|
#printf '\e[7;35m[7;35m Purple\e[0m \e[7;45m[7;45m Purple\e[0m\n'
|
|
#printf '\e[7;36m[7;36m Cyan\e[0m \e[7;46m[7;46m Cyan\e[0m\n'
|
|
#printf '\e[7;37m[7;37m Light grey\e[0m \e[7;47m[7;47m Light grey\e[0m\n'
|
|
}
|
|
|
|
name="$(basename $0)"
|
|
if test "$name" = "thebookofcolors"; then
|
|
main | less -R
|
|
fi
|