= Terminal colors with ANSI escape sequences

Terminal emulators use ANSI escape sequences to --amongst other things like controlling the cursor's position-- read the desired text and background color when printing output.

    $ echo -e "\033[31mred\033[m" # Prints "red" in red.

While most terminal emulators, including Apple's Terminal.app, support true color now, most utilities use one of the main sixteen colors (black, red, green, yellow, blue, magenta, cyan, white, and a __high intensity__ or __bright__ version of each). For example, git shows diffs with additions in green and deletions in red, and most testing frameworks print green dots and red __"F"__s for failures.

[cols="8"]
|===
|[white]#Black (0)# {set:cellbgcolor:black}
|[white]#Red (1)# {set:cellbgcolor:maroon}
|[white]#Green (2)# {set:cellbgcolor:green}
|[white]#Yellow (3)# {set:cellbgcolor:olive}
|[white]#Blue (4)# {set:cellbgcolor:navy}
|[white]#Purple (5)# {set:cellbgcolor:purple}
|[white]#Cyan (6)# {set:cellbgcolor:teal}
|[white]#White (7)# {set:cellbgcolor:silver}
|Bright black (8) {set:cellbgcolor:gray}
|Bright red (9){set:cellbgcolor:red}
|Bright green (10){set:cellbgcolor:lime}
|Bright yellow (11){set:cellbgcolor:yellow}
|Bright blue (12){set:cellbgcolor:blue}
|Bright purple (13){set:cellbgcolor:fuchsia}
|Bright cyan (14){set:cellbgcolor:cyan}
|Bright white (15){set:cellbgcolor:white}
|===

By using relative values, it's up to the terminal emulator to decide which color it prints as "red". Most even make them configurable through themes. This separates the *intent* (_print this error in red_) from the *styling* (_#c23621 is a nice shade of red_).

Beyond the standard and high intensity colors, we arrive in absolute color territory. The color codes from 16 to 255 are used to print 8-bit colors, from which 232 to 255 are grayscales from black to white. Then, there's 32-bit color, also named __true color__, which has 16.777.216 different color values.

    $ echo -e "\033[38;5;205mhotpink\033[m" # prints "hotpink" in hotpink (#205)
    $ echo -e "\033[38;2;243;134;48mgiant goldfish\033[0m\n" # prints "giant goldfish" in #F38630