How to change tty background color

I installed manjaro i3 edition, using manjaro-architect.

However I noticed that the tty terminals don’t have a black background, but a grayish one, which I would like to change.

Do you guys have any idea which config file contains the tty background color in manjaro i3 ?

Cheers !

the actual tty terminals, accessed through control-alt-function keys? i3 doesn’t control that. there might be something modifying it in your .bashrc, though.

First you need to define the colors first in .Xresources. For example with my color scheme:

! Black + DarkGray
*color0:  #232729
*color8:  #6B6D76
! Red + Light Red
*color1:  #F9564F
*color9:  #F87873
! Green + Light Green
*color2:  #9AE19D
*color10: #A2DFA4
! Brown/Yellow + Yellow
*color3:  #FCFC62
*color11: #F7F78A
! Blue + Light Blue
*color4:  #9AE5E6
*color12: #A6E3E4
! Magenta + Light Magenta
*color5:  #E3DCC2
*color13: #E4DEC9
!Cyan + Light Cyan
*color6:  #A8F9FF
*color14: #BAFAFF
! LightGray + White
*color7:  #EFEFEF
*color15: #FDFDFF

Then append this to your .bashrc (for bash shell) or .zshrc (for zsh shell)

if [ "$TERM" = "linux" ]; then
    _SEDCMD='s/.*\*color\([0-9]\{1,\}\).*#\([0-9a-fA-F]\{6\}\).*/\1 \2/p'
    for i in $(sed -n "$_SEDCMD" $HOME/.Xresources | awk '$1 < 16 {printf "\\e]P%X%s", $1, $2}'); do
        echo -en "$i"

Thank you for your answer !

This works but not exactly the way I want it to. I have already set the .Xresources colors to customize my i3 environment, and I don’t want the tty terminals to look the same. I would prefer them to look simpler (black background mainly).

Also, I would like this to take effect before login, so I guess that I would have to modify a config file in etc not the home directory.

I have looked (using grep) in all the config files (in /etc/* , /etc/*/* , and ~/ ) for a line that would contain TERM or echo -en but I could not find any. Thus I am wondering where the manjaro i3 install sets this ?

Maybe someone from the dev team of the i3 edition could give us a hint ? Is it hardcoded somewhere or is it available in a config file.

If you want to set up color for your tty only, you can do this :

if [ "$TERM" = "linux" ]; then
    echo -en "\e]P0232323" #black
    echo -en "\e]P82B2B2B" #darkgrey
    echo -en "\e]P1D75F5F" #darkred
    echo -en "\e]P9E33636" #red
    echo -en "\e]P287AF5F" #darkgreen
    echo -en "\e]PA98E34D" #green
    echo -en "\e]P3D7AF87" #brown
    echo -en "\e]PBFFD75F" #yellow
    echo -en "\e]P48787AF" #darkblue
    echo -en "\e]PC7373C9" #blue
    echo -en "\e]P5BD53A5" #darkmagenta
    echo -en "\e]PDD633B2" #magenta
    echo -en "\e]P65FAFAF" #darkcyan
    echo -en "\e]PE44C9C9" #cyan
    echo -en "\e]P7E5E5E5" #lightgrey
    echo -en "\e]PFFFFFFF" #white
    clear #for background artifacting

If you want to change the background color, just alter the color code for black one

Of course you can’t find any. They are not referenced anywhere in config files or the terminal itself. You can only change the definitions of the color indexes by doing the above that I suggested to you or by editing the kernel source and recompiling

1 Like

I will try this ASAP and keep you posted.
I intend to add the following lines to /etc/bash.bashrc and /etc/zsh/zshrc :

if [ "$TERM" = "linux" ]; then
    echo -en "\e]P0000000" #black
    clear #for background artifacting

As for this :

The kernel that I installed using manjaro-architect did not seem to be a custom one, unless choosing the i3 desktop recompiled the kernel to modify the tty background.
This is why I was looking for some config files to modify. As a comparison, I had installed the xfce edition of manjaro using calamares some time ago, and the tty background was black.

Thanks again !

Edit: Okay it seems to work with adding the relevant lines only to /etc/profile. However the background color modification only happens after login. There still remains the issue of the background color before. I will to look at the other config files.

If i wanna change the background in URXVT in i3, i change the background options in the “.extend.Xresources” file.
Change the colors, reboot and its done.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by