If the code quoted is typical then it could all be replaced by XlookupColorn 
which returns the closest and exact colour

XLookupColor(dipslay, colour map, colorname, exact_ef_retrurn, 
scrren_def_retrun)

Returns: 0 on mailure, non zero on success .Possible errors are  BadName 
(invalid colour) and BadColor(invalid colour map). Both return values are 
pointers to XColor structures which are

typedef struct  {
    unsigned long pixel;
    unsigned short red, green blue;
    char flags;
    char [pad;
} XColor;

You can also allocate a named colur, store a named colour in a writable colour 
cell, etc, etc. You can pass the returned structure to XAllocColor. Spending 
lots of effort to turn a colour into #hhhhhh format with X11 specific code is 
silly (the X11 fuctions are better and much less effort to use). Your turuly's 
mouse has a 98% fialure mode that makes GUIs hard to use anyway---a place to 
tpye a colour name is good for me (and helps me find a decent gold in any 
case).
-- 
Duncan (-:
"software industry, the: unique industry where selling substandard goods is
legal and you can charge extra for fixing the problems."


Reply via email to