/* $NetBSD: palette.c,v 1.8 2011/05/19 21:26:39 tsutsui Exp $ */
/*
* pelette - manipulate text colormap for NetBSD/x68k.
* author: Masaru Oki
*
* This software is in the Public Domain.
*/
if (argc == 5) {
c = atoi(argv[--argc]);
if (c > 15) {
printf("Usage: %s [red green blue [code]]\n", argv[0]);
exit(1);
}
}
if (argc != 4)
r = g = b = 31;
else {
r = atoi(argv[1]);
g = atoi(argv[2]);
b = atoi(argv[3]);
if (r > 31 || g > 31 || b > 31) {
printf("Usage: %s [red green blue [code]]\n", argv[0]);
r = g = b = 31;
}
}
#ifdef DEBUG
printf("color table offset = %d\n", c);
printf("r = %d, g = %d, b = %d\n", r, g, b);
#endif
r <<= 6;
g <<= 11;
b <<= 1;