#include #include #include #include #include using namespace std; /* saturation, value and hue all are 0..1 */ static void MakeTint(char *dest, double saturation, double value, double hue) { const double v = value * 255.0; hue *= 6.0; const double f = hue - (int)hue; const double x = v * (1.0 - saturation); const double y = v * (1.0 - (saturation * f)); const double z = v * (1.0 - (saturation * (1.0 - f))); unsigned hex; switch((int)hue) { case 0: hex = (((unsigned)v) << 16) | (((unsigned)z) << 8) | ((unsigned)x); break; case 1: hex = (((unsigned)y) << 16) | (((unsigned)v) << 8) | ((unsigned)x); break; case 2: hex = (((unsigned)x) << 16) | (((unsigned)v) << 8) | ((unsigned)z); break; case 3: hex = (((unsigned)x) << 16) | (((unsigned)y) << 8) | ((unsigned)v); break; case 4: hex = (((unsigned)z) << 16) | (((unsigned)x) << 8) | ((unsigned)v); break; default:hex = (((unsigned)v) << 16) | (((unsigned)x) << 8) | ((unsigned)y); break; } sprintf(dest, "#%06X", hex); } int main(int argc, const char* const* argv) { srand48(time(NULL)); double tint = drand48(); static char Tausta[8] = "#000000"; static char Kursori[8] = "#FFFFFF"; MakeTint(Tausta, 0.15, 1.00, tint); MakeTint(Kursori, 0.20, 1.00, tint); static const char * parms[40] = { "xterm", "-bg", "black", "-fg", "gray", "-fa", "r24:size=4.5", "+fbb", "+rv", "+bdc", "-wc", "-bw", "0", "-cr", Kursori, "-k8", "-sl", "5000", "-geometry", "160x45", "-title", "please disregard this window, it's not important", NULL, NULL, NULL }; const char** p = parms; while(*p) ++p; if(argc != 1) { *p++ = "-e"; *p++ = argv[1]; } execvp(parms[0], (char *const *)parms); return 0; }