I change the color of my prompt in the console by changing the PS1 variable in my .bashrc like this:


COLOR_… are variables.

But it gets overwritten by the console color scheme. How can i stop the console from overwriting my .bashrc settings?

  • If I remember correctly, the ansii colour codes you'll be using are numbers, not colours. So for example maybe colour 3 is green by default and you're saying to use colour 3. Whereas konsole's colour schemas map different colours to the numbers. So you can either change your colour numbers to find something you like, or else you can in konsoles settings, look for a menu to select a "default" colour scheme which has the traditional number-to-colour mappings
    – Chunko
    Feb 12 '17 at 15:26

Applications running in the terminal, such as the shell, send escape sequences to the terminal to change the appearance of subsequent output. The escape sequence to change the character attributes is CSI Pm m where CSI stands for the two-character sequence ESC [ (which can be written in bash as $'\e[') and Pm is a sequence that determines what to change.

Presumably your configuration uses the 8 standard colors, i.e. $COLOR_USER is something like $'\e[31m' to get red text. The appearance of standard colors can be chosen freely by the terminal. If you use a theme in Konsole, it may tweak the colors however it pleases. Good themes would just pick a decent shade but some Konsole themes completely change them.

You can use an escape sequence that specifies a color by its red-green-blue components: CSI 3 8 ; 2 ; Pr ; Pg ; Pb m (where Pr, Pg and Pb are the red-green-blue components respectively, on a scale of 0 to 255). Konsole will respect that. For example, to get the user name in red:


Alternatively, use a color theme that respects the colors that the application specified, instead of completely messing them up.

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.