1 #include <X11/X.h>
2 #include <X11/Intrinsic.h>
3 #include <stdio.h>
4 
main(int argc,char * argv[])5 int main( int argc , char * argv[] )
6 {
7    int ii ;
8    XColor ex_col , sc_col ;
9    Widget shell ;
10    XtAppContext app ;
11    Display * display ;
12    Screen *  screen ;
13    Colormap  colormap ;
14 
15    shell = XtVaAppInitialize(
16               &app , "AFNI" , NULL , 0 , &argc , argv , NULL , NULL ) ;
17 
18    display  = XtDisplay(shell) ;
19    screen   = XtScreen(shell) ;
20    colormap = DefaultColormapOfScreen( screen ) ;
21 
22    ii = XParseColor( display , colormap , argv[1] , &ex_col ) ;
23    if( ii == 0 ){ fprintf(stderr,"XParseColor failed\n") ; exit(1) ; }
24 
25    printf("R = %d  G = %d  B = %d\n",ex_col.red,ex_col.green,ex_col.blue) ;
26    exit(0) ;
27 }
28