Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using Gentoo with XMonad and set all the colors in .Xresources file. The problem is that for some apps setting *.background and *.foreground is not enough since they override the settings for some fields. Here's an example of what's wrong:

enter image description here

The background should be similar to the dark window elements, but it's white and gray instead.

What are some other xresources variables that set dialog window colors and what is the correct way to overcome this problem?

My current .Xresources file:

! Solarized colorscheme for Xresources
! ====================================




! To choose between light/dark bakground:
! - Define the choice in ``.Xresources`` by hardcoding
!   #define SOLARIZED_LIGHT
!   or
!   #define SOLARIZED_DARK
! - Define the symbol when loading ``.Xresources`` with ``xrdb``:
!   $ xrdb -DSOLARIZED_LIGHT -merge ~/.Xresources




#if !defined(SOLARIZED_LIGHT) && !defined(SOLARIZED_DARK)
#define SOLARIZED_DARK
#elif defined(SOLARIZED_LIGHT) && defined(SOLARIZED_DARK)
#undef SOLARIZED_LIGHT
#endif




! Define Solarized colors
! -----------------------
#define S_base03    #002b36
#define S_base02    #073642
#define S_base01    #586e75
#define S_base00    #657b83
#define S_base0     #839496
#define S_base1     #93a1a1
#define S_base2     #eee8d5
#define S_base3     #fdf6e3




#define S_yellow    #b58900
#define S_orange    #cb4b16
#define S_red       #dc322f
#define S_magenta   #d33682
#define S_violet    #6c71c4
#define S_blue      #268bd2
#define S_cyan      #2aa198
#define S_green     #859900




#ifdef SOLARIZED_LIGHT
#define S_emph      S_base01
#define S_primary   S_base00
#define S_secondary S_base1
#define S_bgrnd_hi  S_base2
#define S_bgrnd     S_base3
#endif
#ifdef SOLARIZED_DARK
#define S_emph      S_base1
#define S_primary   S_base0
#define S_secondary S_base01
#define S_bgrnd_hi  S_base02
#define S_bgrnd     S_base03
#endif




! black dark/light
*color0:                S_base02
*color8:                S_base03
! red dark/light
*color1:                S_red
*color9:                S_orange
! green dark/light
*color2:                S_green
*color10:               S_base01
! yellow dark/light
*color3:                S_yellow
*color11:               S_base00
! blue dark/light
*color4:                S_blue
*color12:               S_base0
! magenta dark/light
*color5:                S_magenta
*color13:               S_violet
! cyan dark/light
*color6:                S_cyan
*color14:               S_base1
! white dark/light
*color7:                S_base2
*color15:               S_base3








! General Xresource settings
! ==========================
!
#define FONT_REGULAR xft:Liberation Mono:style=Regular:pixelsize=14 
#define FONT_BOLD xft:Liberation Mono:style=Bold:pixelsize=14 
#define FONT_ITALIC xft:Liberation Mono:style=Italic:pixelsize=14 
Xft*antialias: true




*foreground:                S_primary
*background:                S_bgrnd
*Foreground:                S_primary
*Background:                S_bgrnd
*cursorColor:               S_emph
*pointerColorForeground:    S_emph
*pointerColorBackground:    S_secondary
*fading:                    40
*fadeColor:                 S_bgrnd








! Xscreensaver
! ============
xscreensaver.captureStderr: false
!font settings
xscreensaver.Dialog.headingFont: FONT_REGULAR
xscreensaver.Dialog.bodyFont:    FONT_REGULAR 
xscreensaver.Dialog.labelFont:   FONT_REGULAR 
xscreensaver.Dialog.unameFont:   FONT_REGULAR 
xscreensaver.Dialog.buttonFont:  FONT_REGULAR 
xscreensaver.Dialog.dateFont:    FONT_REGULAR 
xscreensaver.passwd.passwdFont:  FONT_REGULAR 
!general dialog box (affects main hostname, username, password text)
xscreensaver.Dialog.foreground: S_primary
xscreensaver.Dialog.background: S_bgrnd
xscreensaver.Dialog.topShadowColor: S_bgrnd
xscreensaver.Dialog.bottomShadowColor: S_bgrnd
xscreensaver.Dialog.Button.foreground: S_primary
xscreensaver.Dialog.Button.background: S_bgrnd_hi
!username/password input box and date text colour
xscreensaver.Dialog.text.foreground: S_primary
xscreensaver.Dialog.text.background: S_bgrnd_hi
xscreensaver.Dialog.internalBorderWidth: 24
xscreensaver.Dialog.borderWidth: 0
xscreensaver.Dialog.shadowThickness: 1
xscreensaver*logo.width: 1
xscreensaver*logo.height: 1
!timeout bar (background is actually determined by Dialog.text.background)
xscreensaver.passwd.thermometer.foreground: S_red
xscreensaver.passwd.thermometer.background: S_blue
xscreensaver.passwd.thermometer.width: 4




 
! rxvt-unicode terminal
! =====================
!
URxvt*background: S_bgrnd
URxvt*foreground: S_primary
URxvt*font: FONT_REGULAR
URxvt*boldFont: FONT_BOLD
URxvt*italicFont: FONT_ITALIC
URxvt.colorIT: S_magenta
URxvt.colorBD: S_green
URxvt.colorUL: S_blue
URXVT.borderColor: S_bgrnd_hi
URxvt.highlightColor: S_bgrnd_hi
URxvt.scrollBar: false
URxvt.saveLines: 1000
URxvt.cursorBlink: true
URxvt.pointerBlank: true
URxvt.modifier: alt
share|improve this question

migrated from superuser.com Dec 14 '12 at 23:41

This question came from our site for computer enthusiasts and power users.

    
Unfortunately, there's no standard for how colors are organized: each application does its own thing. It isn't practical to set resources that are used by every application. You'll need to add or override some settings for this application. What is it? –  Gilles Dec 16 '12 at 0:33
    
The same behavior have all the GUI applications with such kind of text lines list: Skype, Calibre, KeePassX are just the first ones to concern. Also the background should not be white. *background setting should redefine background for all possible apps using such field. Apparently there is another value responsible for text background or highlights. –  Zoresvit Dec 16 '12 at 10:13

2 Answers 2

up vote 2 down vote accepted

just be more specific :)

instead of:

*background: ...

use:

*vt100.background: ...

this will ensure you are only affecting the vt100 terminals and not other apps. I had this issue with Mathematica and my solution should work for you too. by the way, I like how you implemented the light/dark switching.

share|improve this answer
    
@slm, thanks for fixing my answer. –  qweilun Jun 17 at 20:25

This definitely sounds similar to the problem I had with XClock some time ago:
Facelifting XClock while using Xrender: A long and winding road

Reading the very good answer by Drav Sloan will most probably give you some more insights into the inner workings of .Xresources. By understanding these, one will be surprised to learn about their actual complexity, which won't reveal itself at a first superficial glance.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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