I added this line in .Xresources:

urxvt.background: #0f0f0f

And ran xrdb -merge .Xresources. However, for some reason, the terminal is set to the color when it is launched, but as soon as the $PS1 tag appears, the background is reset to black. I tried using URxvt*background but it didn't work either.

Here is my $PS1

reset=$(tput sgr0)
bold=$(tput bold)
    PS1="[\[$bold\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[$reset\]]\$ "

However, it is normally handled by powerline-shell. Though, when I disable it, it still resets the color.

EDIT: I modified it, and now it looks like this:

if [ "$color_prompt" = yes ]; then
    #Default setting
unset color_prompt force_color_prompt

I added the whole block of code in, just in case. The color is still resetting unfortunately.

UPDATE : I managed to find out that the background color is the same as the first color in the palette. Is there anyway I could override that?

  • What is your $PS1? In which shell? Oct 24 '17 at 23:19
  • Updated the question with the $PS1, and the shell is Bash. Oct 24 '17 at 23:24
  • What's the value of $TERM, and the output of tput sgr0 | cat -A? Oct 24 '17 at 23:42
  • $TERM says rxvt-unicode-256color: command not found, and tput sgr0 | cat -A says ^[[m^[(B Oct 25 '17 at 10:11

I found out what the problem is -

Firstly - urxvt doesn't let you change the background color if the transparency is turned on. It automatically sets it to black.

Secondly - a different app, called pywal, was setting my colorscheme. I simply didn't know it was also setting the background, and I didn't check beforehand. That was my mistake.

If I had any tips to give - it's to check everything that may be messing with your colorscheme, and disable urxvt's transparency, using a compositing manager instead to deal with it.


Had similar problem, solution for me was to disable transparency in ~/.Xresources

URxvt.transparent: false
reset=$(tput sgr0)

Well there you go. You are using the sgr0 capability which is defined as resetting all attributes and colours.

… \033[00m … \033[00m …

You are even hardwiring it in the prompt several times over.

Do not do that, then.

terminfo lacks a capability for obtaining the reset bold sequence. But since you are hardwiring ECMA-48 control sequences anyway you might as well hardwire the ECMA-48:1984 control sequence CSI 2 2 m (i.e. \033[22m) to just turn off boldface. Unicode RXVT supports it.

  • I forgot that's what that particular bit did, let me try to modify it. Oct 25 '17 at 10:10
  • I changed the $PS1 and made it look like above, but the effect is still happening unfortunately. Oct 25 '17 at 10:21

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.