Setting COLOR, GRAYSCALE, and MONOCHROME RESOURCES
It is possible to specify different resources for X applications
depending on what display you are using.
The easiest distinction is whether you are using a color or monochrome
monitor. In your .Xresources file you could type, for example:
#ifdef COLOR /* these are color resources */
Emacs*Foreground: cyan
Emacs*CursorColor: red
Emacs*PointerColor: green
#else /* and these are monochrome */
Emacs*Foreground: white
Emacs*CursorColor: white
Emacs*PointerColor: white
#endif
The .Xresources file is passed through a C preprocessor called /lib/cpp.
You can type "man cpp" for more information on various things that you
can do with it.
It is a little bit harder to differentiate between grayscale and color
monitors, but it is possible. Example:
#if (CLASS == StaticGray || CLASS == GrayScale )
#define GRAYSCALE 1
#endif
#ifdef COLOR /* these are color resources */
Emacs*Foreground: cyan
Emacs*CursorColor: red
Emacs*PointerColor: green
#elif GRAYSCALE /* these are for grayscale */
Emacs*Foreground: grey80
Emacs*CursorColor: white
Emacs*PointerColor: grey10
#else /* and these are monochrome */
Emacs*Foreground: white
Emacs*CursorColor: white
Emacs*PointerColor: white
#endif
The first three lines check the CLASS variable defined by xrdb, and if
it is StaticGray or GrayScale, then the keyword GRAYSCALE is defined and
you can use it in your definitions.
For more information type:
man xrdb
To see all the symbols defined by xrdb type:
xrdb -symbols
|