1 /*
2 // color.c
3 //
4 //
5 */
6 
7 #include "xbook.h"
8 
GetColor(display,name,colormap,default_color)9 unsigned long GetColor( display, name, colormap, default_color )
10 Display     *display;
11 char        name[];
12 Colormap    colormap;
13 unsigned long default_color;
14 {
15      unsigned long   color;
16      XColor          rgbcolor, hardwarecolor;
17      int             status;
18 
19      color = default_color;
20      status = XLookupColor( display, colormap,  name,
21 			   &rgbcolor, &hardwarecolor );
22      if( status != 0 )
23        {
24 	 status = XAllocColor( display, colormap,
25 			      &hardwarecolor );
26 	 if( status != 0 )
27 	   {
28 	     color = hardwarecolor.pixel;
29 	   }
30        }
31      return (color);
32    }
33