#include <stdio.h>

main()
{
	int t,b,i,f;
	int color;

	do
	{
		printf(
"Give color of text(0-7), background(0-7), intensity(0-1) and flash(0-1)\n");
		printf(
"0=black  1=blue  2=green  3=cyan   4=red  5=magenta  6=yellow  7=white\n");
		scanf("%d%d%d%d",&t,&b,&i,&f);
		color=make_color(t,b,i,f);
		printf("color = %d -- 0x%x\n          Again?  (y or n)\n\n",color,color);
	}while(getch()=='y');
}


/***********************************************************************
**
**		text = text color
**    back = background color
**   shade = text brightness -- 0 for dark and 1 for bright
**   flash = 0 for steady and 1 for flash
**
************************************************************************/

int make_color(int text,int back,int shade,int flash)

{
	int color=flash;

	color<<=3;
	color|=back;
	color<<=1;
	color|=shade;
	color<<=3;
	color|=text;
	return(color);
}
                                                                                                 