SAS / Graph and other applications use hexidecimal (base 16 or hex) values for colors. A single hex digit (1/2 an octet) can contain 16 values using 0 thru 9 then A (10) thru F (15). A byte can handle 256 colors (0 to 255 decimal or 00 to FF hex). A red, green, blue (RGB) primary color triplet (24 bit) can handle 16,777,216 colors as can be seen here:
data _null_ ; color1 = 16 ** 2 ; color3 = color1 ** 3 ; put ( color: ) ( @5 = comma10. / ) ; run ; color1=256 color3=16,777,216
If you need to obtain a specific computer color, you can do that using Microsoft Paint by following these steps:
- Press Alt-PrintScreen to capture the screen
- Start MS Paint and paste (control-V) the image
- Click on the Color picker (eye dropper symbol)
- Click on the desired color
- Click on Edit Colors to see the decimal values
%macro rgbtohex( r, g, b ) ; CX%sysfunc(putn(&r.,hex2.))%sysfunc(putn(&g.,hex2.))%sysfunc(putn(&b.,hex2.)) %mend ; %put %rgbtohex( 106, 89, 59 ) ; CX6A593B
No comments:
Post a Comment