/* color.c
	vi:ts=3 sw=3:
*/

/* $Id: color.c,v 1.7 1995/10/13 18:06:17 espie Exp espie $
 * $Log: color.c,v $
 * Revision 1.7  1995/10/13 18:06:17  espie
 * *** empty log message ***
 *
 * Revision 1.6  1995/05/30 13:08:09  espie
 * *** empty log message ***
 *
 * Revision 1.4  1995/05/11  12:23:36  espie
 * *** empty log message ***
 *
 * Revision 1.3  1995/03/08  13:48:44  espie
 * *** empty log message ***
 *
 * Revision 1.2  1995/03/06  23:36:05  espie
 * Proper color patch.
 *
 * Revision 1.1  1995/03/02  13:52:25  espie
 * Initial revision
 *
 */

char *write_color(base, color)
char *base;
int color;
	{
#ifdef __OS2__
	// The first 7 colors are totally useless
	if(color>0)
		color = color % 8 + 8;
#endif
	*base++ = '\033';
	*base++ = '[';
#ifdef AMIGA
#else
#ifdef SCO_ANSI_COLOR
	if (color == 0)
		{
		*base++ = 'x';
		return base;
		}
#endif
	*base++ = '0' + color / 8;
	*base++=';';
	*base++='3';
	if (color == 0)		/* color == 0 means reset */
		*base++ = '9';
	else
		*base++ = '0' + color % 8;
	*base++ = 'm';
#endif
	return base;
	}
