3

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

  • 1
    Are you asking why someone would want to change green and red to different colors since they can't see those colors but could remap them to orange and blue perhaps? Basically, let's say someone explains an opinion or reason why they feel this exists. What will you do with that knowledge (or is there a practical question lying buried here that we can address directly?)? – bmike Jul 1 '18 at 15:42
  • I know how to swap default colors but how can I make custom ANSI colors show up in the shell. What's the point of setting custom colors in the preferences panel if they don't take effect in the shell? – Char Jul 1 '18 at 15:58
  • Aah - so this is more about why don’t all programs or all code adopt these colors rather than layering on conflicting standards and escape sequences... – bmike Jul 1 '18 at 16:39
  • 1
    I have tried changing the LSCOLORS....but that didn't work. I think this is the actual question here. But to answer it, we need to know what you attempted and what your results were – Allan Jul 5 '18 at 18:30
3
+50

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.

  • What terminal commands make use of user-defined color codes? – Char Jul 11 '18 at 16:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .