* Re: rgb.txt
1995-01-05 15:17 rgb.txt Emmanuel Courcelle
@ 1995-01-06 15:42 ` Mark Wassell
1995-01-12 17:42 ` rgb.txt Dave Hill
1 sibling, 0 replies; 3+ messages in thread
From: Mark Wassell @ 1995-01-06 15:42 UTC (permalink / raw)
In <3eh2hl$7a1@reseau.cict.fr> manu@ecstasy.cemes.fr (Emmanuel Courcelle)
writes:
> I already introduced the color in the rgb.txt file with an editor, but
> I do not know how to update the rgb.pag and rgb.dir files (all those
> files are under /usr/lib/X11).
The rgb.pag and rgb.dir files make up a database which can be accessed, created
and updated using the dbm(3) family of subroutines. I've included a little
C program I wrote to do what you want to do (it might need a little tweaking
to fit in with your needs). Perl also has dbm cabilities.
Having said all this I'm sure that someone has written a better utility for
this.
I hope this helps.
#include <ndbm.h>
#include <stdio.h>
DBM *mydb;
main()
{
mydb=dbm_open("rgb",DBM_REPLACE,0);
AddColour(203,203,192,"scobackground"); /* ivory3 */
AddColour(11, 0, 113,"scoforeground"); /* navyblue */
AddColour(255, 240, 248,"scotopshadow"); /* lav blush */
AddColour(255,206,137,"scoactivebackground");
AddColour(43, 45, 49,"scoactiveforeground");
AddColour(254, 222, 255,"scoactivetopshadow");
AddColour(172, 186, 204,"scoaltbackground");
AddColour(141, 178, 215,"scohighlight");
PrintDb();
dbm_close(mydb);
}
DeleteColor(keystr)
char *keystr;
{
datum key;
MakeKey(&key,"blue");
dbm_delete(mydb,key);
}
MakeKey(key,keystr)
datum *key;
char *keystr;
{
key>dsize = strlen(keystr);
key>dptr = (char*)malloc(key>dsize+1);
strcpy(key>dptr,keystr);
}
AddColour(c1,c2,c3,keystr)
char *keystr;
unsigned char c1,c2,c3;
{
datum data;
datum key;
MakeKey(&key,keystr);
data.dsize=6;
data.dptr = (char*)malloc(data.dsize);
data.dptr[0]=c1;
data.dptr[1]=c1;
data.dptr[2]=c2;
data.dptr[3]=c2;
data.dptr[4]=c3;
data.dptr[5]=c3;
dbm_store(mydb,key,data,DBM_INSERT);
}
PrintDb()
{
datum key;
datum data;
int i;
unsigned char colval[3];
char colname[100];
for(key=dbm_firstkey(mydb);key.dptr!=NULL;key=dbm_nextkey(mydb))
{
data=dbm_fetch(mydb,key);
strncpy(colname,key.dptr,key.dsize);
colname[key.dsize]=0;
printf("%s %d %d %d\n",colname,(unsigned char)data.dptr[0],
(unsigned char)data.dptr[2],(unsigned char)data.dptr[4]);
}
}
___ ___
|\ | | Mark Wassell
| \ |\ \ | N.C. Graphics,
| \| \__ \__| Waterbeach, Cambridge
N.C. Graphics (Cambridge) Ltd. Tel:(0223) 861539 UK, CB5 9NN
#include "disclaimer.h"
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: rgb.txt
1995-01-05 15:17 rgb.txt Emmanuel Courcelle
1995-01-06 15:42 ` rgb.txt Mark Wassell
@ 1995-01-12 17:42 ` Dave Hill
1 sibling, 0 replies; 3+ messages in thread
From: Dave Hill @ 1995-01-12 17:42 UTC (permalink / raw)
In article <3eh2hl$7a1@reseau.cict.fr>, manu@ecstasy.cemes.fr (Emmanuel Courcelle) writes:
|> Hello, evrybody.
|>
|> I would like to introduce a new color in the rgb database, on a Dec
|> osf/1 2.0 machine. How do I do that ???
|>
|> I already introduced the color in the rgb.txt file with an editor, but
|> I do not know how to update the rgb.pag and rgb.dir files (all those
|> files are under /usr/lib/X11).
|>
The rgb command is not normally installed. As distributed from the X
Consortium, the installation procedures do not install the command.
The rgb command is only used for compiling the rgb database when
building the X window system.
As of X11R5, the functionality of the rbg command has been superseded
by the X Color Management System (Xcms). Instead of adding to the rgb
database, one can either create a color definition file in
/usr/lib/X11/Xcms.txt or one can use a personal color definition file
defined in the value of the XCMSDB environment variable.
The old (R4) color method of defining colors (a '#' followed by a hex
number) can still be used, but there are many color-space formats
recognized. Here is an example Xcms.txt data file:
XCMS_COLORDB_START 0.1
mygreen RGBi:0.1/0.9/0.1
UglyGreen TekHVC:88.00004/72.66564/38.25869
myPurple #c01095
XCMS_COLORDB_END
Note that you must use a tab character between the color name and the start
of the color specification.
Note that it is no longer necessary to compile the color data file in any
way. Simply the existance of the /usr/lib/X11/Xcms.txt file or the file
referred to in the XCMSDB environment variable is sufficient.
For more information on Xcms, refer to Chapter 6 the "X Window System
Administrator's Guide" published by O'Reilly & Associates, Inc. and
distributed with the DEC OSF/1 documentation.
^ permalink raw reply [flat|nested] 3+ messages in thread