0

I would like to change the default colors used by the terminal (in particular the blue that is difficult to read with black background).

How can I achieve that result? I know this has been asked a lot, but with respect to terminal emulators, and in this case I am asking for the plain terminal without X11 or DE.

MC68020
  • 6,281
  • 2
  • 13
  • 44
00M
  • 11
  • 2
  • I voted for reopening this question since while acknowledging the quality of the thread @ThomasDickey pointed to, I fail to read how it echoes / answers OP's question. – MC68020 Nov 14 '22 at 23:58
  • 1
    OP asked "change the default colors used by the terminal", which is done using the *palette* controls as in `setterm`. Your answer doesn't modify the default colors, and does not actually answer OP's question. – Thomas Dickey Nov 15 '22 at 00:37

1 Answers1

-1

How colorizing output is achieved on a linux console :

By sending ansi escape sequences to the tty driver. Just try :

echo -e "\e[31mThis is displayed in red\e[0m"

We then can understand it is up to the running program to decide what is to be printed in which color.

This escape sequence might be hardcoded : (Like if I had written the above line as part of some shell script) In which case you just cannot do much apart from either changing the source code or fiddling the terminal capabilities database which is tedious non portable work.
Note that most of these programs generally offer some optional parameter on the command line aiming at enabling/disabling colorized output. (see for example the --color option in grep.)

This escape sequence might depend on some user defined environment variable :

  • Most shells will honor the PS1 environment variable for displaying the primary command prompt, variable that can contain ansi escape sequences.
  • utilities like ls can honor the LS_COLOUR environment variable for colorizing filenames depending on the type of the associated file.

This escape sequence might honor user settings as part of some dedicated and particular configuration file.

  • Most used/known vim editor would conform its output to definitions standing in the .vimrc a configuration file you would have to edit first.
  • Other utilities like top (via .toprc) also conform to some configuration file but enable its definitions to be set at runtime.

So… each to its own way, read the manual for each particular command and see what applies.

MC68020
  • 6,281
  • 2
  • 13
  • 44