LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   I can't change xterm's colors (with Xresources) (https://www.linuxquestions.org/questions/slackware-14/i-cant-change-xterms-colors-with-xresources-654080/)

jsmith6 07-07-2008 08:54 AM

I can't change xterm's colors (with Xresources)
 
I am trying to set custom colors in Xterm via the file ~/.Xresources but Xterm doesn't respond. Here is what Xresources contains:

Code:

XTerm*color0: rgb:0/0/0
XTerm*color1: rgb:cc/00/00
XTerm*color2: rgb:00/cc/00
XTerm*color3: #bd5e01
XTerm*color4: rgb:00/00/cc
XTerm*color5: rgb:cc/00/cc
XTerm*color6: rgb:00/cc/cc
XTerm*color7: rgb:aa/aa/aa
XTerm*color8: rgb:33/33/33
XTerm*color9: rgb:ff/00/00
XTerm*color10: rgb:00/ff/00
XTerm*color11: rgb:ff/ff/00
XTerm*color12: rgb:00/00/ff
XTerm*color13: rgb:ff/00/ff
XTerm*color14: rgb:00/ff/ff
XTerm*color15: rgb:ff/ff/ff

Xterm responds only to those two:

Code:

!xterm*background: black
!xterm*foreground: grey

How can I set my Xterm colors?

I don't mind if it's going to be another way than editing Xresources. If Xterm cannot change colors, I am open to suggestions on another terminal that will allow me to do so (along with changing the font to something smooth like DejaVu Sans Mono).

indeliblestamp 07-08-2008 06:54 AM

It should work fine, that's how my xterm settings are loaded too. And the lines starting with ! ought to be comments, so those definitely shouldn't be responded to. Did you remember to run xrdb to refresh the changes? Otherwise changes will be visible only when restarting X.
Code:

xrdb -merge ~/.Xdefaults
(I think that's the right command).

jsmith6 07-08-2008 08:06 AM

These two options do work:

Code:

xterm*background: black
xterm*foreground: grey

In my first post, I mistakenly left the "!" in (which are comments of course). I do run xrdb -merge ~/.Xdefaults after each change I do. I tried it again but this time I restarted X. Nothing changed.

I tried out setting colors in Hex instead of RGB but again it didn't worked (note that these are random colors, I just created them with Gcolor2 to test whether Xterm will respond):

Code:

xterm*background: black
xterm*foreground: grey
xterm*color0: #8EB327
xterm*color1: #27B3A8
xterm*color2: #A6F097
xterm*color3: #F0C497
xterm*color4: #D997F0
xterm*color5: #767FA6
xterm*color6: #76A2A6
xterm*color7: #76A67F

Does it work on your Slackware 12.1 x86? Can you paste me here your color configuration, perhaps I messed up these colors somewhere.

If it's working on your system then maybe I messed some other configuration file? I don't know...

indeliblestamp 07-08-2008 08:22 AM

Mine's Slackware too, but not x86. I appended your configs to my file, it works fine in my machine. See a snapshot.
Couple of things: you might want to symlink .Xdefaults and .Xresources just to be sure. Also, I've defined those lines as XTerm*color0 instead of xterm*color0, but your way works for me too.
I've uploaded my .Xdefaults here, in case it helps.

nx5000 07-08-2008 08:38 AM

Maybe there are overriden by something in app-defaults ?

locate app-defaults
Should be in /etc/X11/app-defaults/Xterm

cmk77 07-10-2008 04:42 AM

maybe you have an empty space at the end of each line? I remember that Xresources is sensitive to that. "#76A67F" is fine, but "#76A67F " is not.

jsmith6 07-12-2008 02:56 PM

Quote:

Originally Posted by arungoodboy (Post 3207593)
Mine's Slackware too, but not x86. I appended your configs to my file, it works fine in my machine. See a snapshot.
Couple of things: you might want to symlink .Xdefaults and .Xresources just to be sure. Also, I've defined those lines as XTerm*color0 instead of xterm*color0, but your way works for me too.
I've uploaded my .Xdefaults here, in case it helps.

Do you have an IBM System Z?! :-P Just kidding. But out of curiocity, what are you running Slackware on?

Thanks for the screenshot, I never doubted that it worked for you though! :-D Is this fvwm2? Nice theme!

I symlinked .Xdefaults to .Xresources. Nothing changed. Then I removed .Xresources and kept just .Xdefaults. Again, nothing. I tried your Xdefaults (exactly as you have it on pastebin) but again, no change.

Quote:

Originally Posted by nx5000 (Post 3207606)
Maybe there are overriden by something in app-defaults ?

locate app-defaults
Should be in /etc/X11/app-defaults/Xterm

Hm.. I thought that the options in home override any of these defaults. Nevertheless, I tried moving the whole /etc/X11/app-defaults directory to /tmp and then restarted X, but nothing happened.

Quote:

Originally Posted by cmk77 (Post 3209852)
maybe you have an empty space at the end of each line? I remember that Xresources is sensitive to that. "#76A67F" is fine, but "#76A67F " is not.

I checked that one too, but there is no empty space there. I was curious, so I tried this: I placed an empty espace in "xterm*background: black " (which is one of the options that work on me) and it still worked. Does it disable the color/option if you put a space there on your machine?

It would be nice if someone with x86 Slackware could confirm that the colors of Xterm can be changed (you can test any of the configurations that me or the rest posted in this topic).

indeliblestamp 07-12-2008 11:39 PM

By x86 do you mean x86-64? That's the conclusion I jumped to and I now see x86 also refers to normal i[3-6]86 families. My slackware runs on a 32 bit Pentium dual core.
Code:

arun ~ $ uname -a
Linux ares 2.6.24.5-smp #2 SMP Wed Apr 30 13:41:38 CDT 2008 i686 Intel(R) Pentium(R) D CPU 3.00GHz GenuineIntel GNU/Linux
arun ~ $

The WM is Ion3 (see my sig!)
I've kinda run out of ideas here. You could make a deliberate typo in your .Xdefaults, and see whether or not xrdb actually parses the file when you run the merge command. I usually get warnings like 'unterminated single quote'.

cmk77 07-13-2008 06:09 AM

Quote:

I checked that one too, but there is no empty space there. I was curious, so I tried this: I placed an empty espace in "xterm*background: black " (which is one of the options that work on me) and it still worked. Does it disable the color/option if you put a space there on your machine?
It does work for the color but gives warnings:
Code:

bash-3.1$ xterm -bg "black " -fg "white" -fn "10x20"
Warning: Color name "black " is not defined

For the font it does not work:
Code:

bash-3.1$ xterm -bg "black" -fg "white" -fn "10x20 "
xterm:  unable to open font "10x20 ", trying "fixed"....


gnashley 07-13-2008 11:50 AM

Try using 'gray99' as the color -I thinkl that was what it was when I ran into this problem with some other program.

jsmith6 07-20-2008 08:53 PM

Quote:

Originally Posted by arungoodboy (Post 3212730)
The WM is Ion3 (see my sig!)
I've kinda run out of ideas here. You could make a deliberate typo in your .Xdefaults, and see whether or not xrdb actually parses the file when you run the merge command. I usually get warnings like 'unterminated single quote'.

I did. Erm.. Ion3 looks a bit too "hack-ish" for me, and I yearn for the lazyness of Xfce :P

I tried making a deliberate mistake on Xresources and xrdb found it.

Quote:

Originally Posted by gnashley (Post 3213090)
Try using 'gray99' as the color -I thinkl that was what it was when I ran into this problem with some other program.

I tried putting all colors (except background and foreground) as grey99, like this:

Code:

xterm*background: black
xterm*foreground: grey
xterm*color0: gray99
xterm*color1: gray99
xterm*color2: gray99
xterm*color3: gray99
xterm*color4: gray99
xterm*color5: gray99
xterm*color6: gray99
xterm*color7: gray99

But it didn't worked.

Then I found some color codes for xterm and tried again the same with PapayaWhip, like this:

Code:

xterm*background: black
xterm*foreground: grey
xterm*color0: PapayaWhip
xterm*color1: PapayaWhip
xterm*color2: PapayaWhip
xterm*color3: PapayaWhip
xterm*color4: PapayaWhip
xterm*color5: PapayaWhip
xterm*color6: PapayaWhip
xterm*color7: PapayaWhip

It didn't worked either.

I think I am doing something wrong on my side because also tried a few Xresources from the ones that we posted on this topic on Slax 6.0.3 (a LiveCD) and Xubuntu 7.10 (running as LiveCD) and again it didn't worked! (always running xrdb of course).

This... can't be. Not working on 3 different distributions (although Slax is based on Slackware). I am going to download and try it on Knoppix, Fedora liveCD and then FreeSBIE. I will post the results.

In any case, thanks a lot guys! :)

Stroker 07-21-2008 02:13 PM

Well, in Slackware it's call from /etc/X11/xinit/xinitrc

Code:

userresources=$HOME/.Xresources

if [ -f $userresources ]; then
    xrdb -merge $userresources
fi

Something wrong with your HOME env var?
File perms?
Starting X in an unusual way?

Just some thoughts.

jsmith6 07-21-2008 06:20 PM

Quote:

Originally Posted by Stroker (Post 3221848)
Well, in Slackware it's call from /etc/X11/xinit/xinitrc

Code:

userresources=$HOME/.Xresources

if [ -f $userresources ]; then
    xrdb -merge $userresources
fi

Something wrong with your HOME env var?
File perms?
Starting X in an unusual way?

Just some thoughts.

ls -lh ~/.Xresources gives me:

Code:

-rw-r--r-- 1 jsmith users 1.1K 2008-07-21 04:47 .Xresources
This one looks ok.

I had this curstom alias to start X in 96 DPI:

Code:

alias startx='startx -- -dpi 96'
I removed it from /etc/profile.d/coreutils-dircolors.sh, loged out, then loged in again and started X. No change. Is this what you mean with "unusual way"?

My HOME env var seems ok:

Code:

echo $HOME
/home/jsmith


Stroker 07-21-2008 08:43 PM

Have you tried to query the X resources db to see if your entries made it in?

xrdb -query | grep XTerm

jsmith6 07-22-2008 03:24 AM

Since it's not very lengthy, here is my whole xrdb -query:

Code:

XTerm*background:        black
XTerm*color0:        PapayaWhip
XTerm*color1:        PapayaWhip
XTerm*color2:        PapayaWhip
XTerm*color3:        PapayaWhip
XTerm*color4:        PapayaWhip
XTerm*color5:        PapayaWhip
XTerm*color6:        PapayaWhip
XTerm*color7:        PapayaWhip
XTerm*foreground:        grey
Xft.hinting:        1
Xft.hintstyle:        hintmedium
xterm*background:        black
xterm*color0:        PapayaWhip
xterm*color1:        PapayaWhip
xterm*color2:        PapayaWhip
xterm*color3:        PapayaWhip
xterm*color4:        PapayaWhip
xterm*color5:        PapayaWhip
xterm*color6:        PapayaWhip
xterm*color7:        PapayaWhip
xterm*faceName:        Monospace:size=11
xterm*foreground:        grey

When I read your post, I changed back from "xterm*color..." to "XTerm*color..." just in case it made any difference. I guess this is why we see both the "xterm" entries and the "XTerm" entries. I have set all the colors to "PapayaWhip" so that it will become obvious when it starts working.


All times are GMT -5. The time now is 02:52 AM.