home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x
- Path: sparky!uunet!das.wang.com!wang!news
- From: izeek@techunix.technion.ac.il (Ilan Aisic)
- Subject: Re: Getting color names(char*).
- Reply-To: izeek@techunix.technion.ac.il (Ilan Aisic)
- Organization: Technion, Israel Inst. of Technology
- Date: Thu, 3 Sep 1992 11:38:15 GMT
- Message-ID: <1992Sep3.113815.1092@discus.technion.ac.il>
- References: <3533@unisql.UUCP>
- Sender: news@wang.com
- Lines: 47
-
- In article <3533@unisql.UUCP> nandraj@unisql.UUCP (Nandraj Arni) writes:
- > ...
- > Say, if you make an application with motif GUI. You want to get
- >the name of colors of some resources programmitically. How would
- >you do that at any level, Xlib, Xt or Motif?
- > ...
-
- Well, I'm not sure how you do it from Motif. I've done something similar
- in an Xlib program.
- In X, the color names and specifications are listed in the color database
- file. A textual version of it may be usually found in
- /usr/lib/X11/rgb.txt or $OPENWINHOME/lib/rgb.txt.
-
- Two things you have to bare in mind:
- 1. You can display many more colors which don't have names than colors with
- names.
- 2. Often, more than one color name in the color database refer to the same
- RGB (Red Green Blue) values.
-
- As far as I can remember, Xlib doen't provide a way to query a color rgb
- spec or a color cell and get back a "known" color name. Maybe because
- of the clear ambiguity that comes from (1) and (2) above.
- Xlib does provide a way to get the RGB values for a given color name
- with the function "XLookupColor".
-
- If you still want to get the colorname, I suggest you process the rgb.txt
- file yourself and keep it in some kind of a data structure in your
- application. Then, when you want to get the name of a given colorcell,
- you may search this table to find the best match (a topic in itself
- regarding colors). Maybe you'll get a "hit" but then again,
- may get more than one hit and you'll have to decide which one to use.
-
- ____
- / / __
- / / /_/ /| /
- __/_ /__ / / / |/ o o o
-
- Ilan Aisic
- Israel USA
- Voice: 972-4-344474 1-914-644-7710
- Fax: 972-4-342492 1-914-644-7763
- E-mail: izeek@techunix.technion.ac.il ilan@allink.com
- --
-
- ____
- / / __
- / / /_/ /| /
-