What the point of custom ANSI colors in Terminal Preferences

bashcolorterminal

In the preferences of the Terminal App, you can set custom ANSI colors for blue, green, yellow, bright red, etc. but they don't actually change anything in the Shell. For example using ls -G still displays the default ANSI colors. I know that you can customize the text, cursor, and background colors but what effect does changing the ANSI colors do? I have tried changing the LSCOLORS in the bash_profile but that didn't work.

How can I make the ANSI colors in the shell match the set custom colors in the Terminal preferences.

default colors

custom colors

Best Answer

To understand what effect changing those colors have, you'll need to understand how ANSI colors work.

In the early days of ANSI escape codes for coloring, the specification allowed programmers (or other users) to write codes for choosing between 8 colors (black, red, green, yellow, blue, magenta, cyan and white). As a kind of defacto standard terminal makers also allowed for choosing brither versions of the same colors (i.e. bright black, bright red, etc.).

The actual color of "red" or "green" isn't standardized and vary between terminal software. These are the colors that Apple lets you redefine. I.e. if you want your "red" to be more or less red (or something else entirely), it will let you.

Later on work has been done to expand on these escape codes to allow a wider color range. In the ISO standard version of these escape codes it is possible for the programmer to select any 24-bit RGB color by issuing an escape code that specifies the amount of red, green and blue that goes into the specific color they want.

This means that if you run a program in the Terminal that is using the old set of escape codes that reference color "names" (i.e. red, green, cyan) - you can change what those color references mean in the preferences.

However, for programs that use the newer escape codes that reference specific color codes (i.e. rgb(123,74,101)) the programmer has already explicitly asked for a specific color - and you're not able as a user to change that from the Terminal preferences.