.Xresources
我使用 Gentoo 和 XMonad 并设置文件中的所有颜色。问题是,对于某些应用程序来说,设置*.background
和*.foreground
是不够的,因为它们会覆盖某些字段的设置。这是错误的示例:
背景应该与深色窗口元素类似,但它是白色和灰色的。
还有哪些其他设置对话框窗口颜色的 xresources 变量以及克服此问题的正确方法是什么?
我当前的.Xresources
文件:
! 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
答案1
只是更具体一点:)
代替:
*background: ...
使用:
*vt100.background: ...
这将确保您只影响 vt100 终端,而不影响其他应用程序。我在 Mathematica 上遇到了这个问题,我的解决方案也应该适合您。顺便说一句,我喜欢你如何实现明/暗切换。
答案2
这听起来确实与我前段时间遇到的 XClock 问题类似:
使用 Xrender 时改造 XClock:一条漫长而曲折的道路
阅读 Drav Sloan 的非常好的答案很可能会让您对 的内部运作有更多的了解.Xresources
。通过理解这些,人们会惊讶地发现它们实际的复杂性,而乍一看并不会显露出来。