Is it possible to change the contrast of the reverse mode of Linux Console ? I would like something in high-contrast, like pure black and pure white.

The current reverse mode uses a dark-gray as foreground and a light-gray as background, it's difficult to read what is in reverse mode.

Look at the text "Digite caracteres alfanumericos" in the image:


  • 1
    What application is this? – Random832 May 7 '17 at 22:23
  • You could change the colors with e.g. printf '\033]P7FFFFFF\033\\', but this will make it impossible to tell the difference between 'bold' and normal. – Random832 May 7 '17 at 22:26
  • It's an ERP based in Unix multiuser terminals (pseudo terminals: pts). It's a Brazilian ERP (so, it's in Portuguese). It was coded in 80s and 90s. – Luciano May 7 '17 at 23:38

It looks like the program is trying to use "bold" + "reverse" modes, rather than just reverse. This results in "dark gray" on "light gray"

Without being able to change what the program uses, you can change what the colors themselves are. Dark gray is #8 whereas light gray is #7 (black is 0 and white is 15 (F), but you shouldn't need to change them) The Linux console has an escape code ESC ] P n rrggbb to redefine colors, so you can define them with e.g. printf ']033]P7cccccc\033]P8333333' to define them to colors that will have more contrast to each other, but still be distinct from black and white so that "bold" and non-"bold" text can be differentiated from each other. You may want to experiment with different values. Your picture has 808080 and cccccc, the supposed defaults (which I think may not be set on startup, but are reset with ESC ] R) on Linux are 555555 and aaaaaa.

| improve this answer | |
  • Yes ! The program was setting A_REVERSE|A_BOLD and "\e]P" helped a lot. – Luciano May 8 '17 at 17:54
  • Are there ways to adjust foreground and background colors apart ? – Luciano May 8 '17 at 17:57
  • 1
    @Luciano No. If the application is actually using curses, and doesn't also use colors, you might be able to put something together with a custom terminfo entry that has sgr/rev/bold/etc use ansi color codes instead of the standard attribute codes, but that's a bit of a complex way to handle things. – Random832 May 8 '17 at 18:04

The basic problem is that the "white" foreground comes out as gray because a pure white as you want is a bold color. But using fonts that provide 512-glyphs as done for Unicode makes the bold colors unavailable.

Further reading:

| improve this answer | |
  • Er, the issue the OP described is that the reverse part is in gray (i.e. "bold black") instead of black. – Random832 May 7 '17 at 22:23
  • It's the same number in the color palette. I could quote the source-code, but that should have been unnecessary. – Thomas Dickey May 7 '17 at 22:29
  • It might or might not be; there's no particular reason to assume whether the unknown program he is using is trying to use a bright background or not. And even if it is, fixing the foreground would go a long way to being more readable. – Random832 May 7 '17 at 22:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.