#include #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, char** 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 *const parms[] = { "xterm", "-bg", "black", "-fg", "gray", "-fn", "-misc-fixed-bold-r-normal--15-140-75-75-c-90-iso8859-15", "-fb", "-misc-fixed-bold-r-normal--15-140-75-75-c-90-iso8859-15", "+rv", "+bdc", "-T", "šterm", "-wc", "-bw", "0", "-cr", Kursori, "-k8", "-sl", "5000", "-geometry", "80x36" }; std::vector p; p.assign(parms, parms + sizeof(parms)/sizeof(*parms)); p.insert(p.end(), argv+1, argv+argc); p.push_back(NULL); putenv( (char *) "LC_ALL=en_US"); execvp(parms[0], (char* const*) &p[0]); return 0; }