Skip to content Accesskey=4Skip to sub-navigation Accesskey=3View our Accessibility Options MIT Information Systems Home About IS&T Contact IS&T Site Map Search Advanced Search
Getting StartedGetting Services by Topic or Alphabetically Getting Help

On This Page

[Help]

  

Quick Links

Top Level

Related Links

Ask OLC a question

Athena Consulting Homepage

Helpdesk Stock Answers (for Mac/PC questions)


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

MIT Home | Getting Started | Getting Services | Getting Help | About IS&T | Accessibility
Ask a technology question or send a comment about this web page.