Compare commits

...

2 Commits

Author SHA1 Message Date
Jacopo De Simoi 3ac053b940 Use alternate color for dot 6 years ago
Jacopo De Simoi 57dda7c317 Setup alt_color 6 years ago
  1. 14
      ttyclock.c
  2. 1
      ttyclock.h

@ -68,6 +68,7 @@ init(void)
init_pair(0, ttyclock.bg, ttyclock.bg); init_pair(0, ttyclock.bg, ttyclock.bg);
init_pair(1, ttyclock.bg, ttyclock.option.color); init_pair(1, ttyclock.bg, ttyclock.option.color);
init_pair(2, ttyclock.option.color, ttyclock.bg); init_pair(2, ttyclock.option.color, ttyclock.bg);
init_pair(3, ttyclock.bg, ttyclock.option.alt_color);
// init_pair(0, ttyclock.bg, ttyclock.bg); // init_pair(0, ttyclock.bg, ttyclock.bg);
// init_pair(1, ttyclock.bg, ttyclock.option.color); // init_pair(1, ttyclock.bg, ttyclock.option.color);
// init_pair(2, ttyclock.option.color, ttyclock.bg); // init_pair(2, ttyclock.option.color, ttyclock.bg);
@ -249,7 +250,7 @@ draw_clock(void)
/* Draw hour numbers */ /* Draw hour numbers */
draw_number(ttyclock.date.hour[0], 1, 1); draw_number(ttyclock.date.hour[0], 1, 1);
draw_number(ttyclock.date.hour[1], 1, 8); draw_number(ttyclock.date.hour[1], 1, 8);
chtype dotcolor = COLOR_PAIR(1); chtype dotcolor = COLOR_PAIR(3);
if (ttyclock.option.blink && time(NULL) % 2 == 0) if (ttyclock.option.blink && time(NULL) % 2 == 0)
dotcolor = COLOR_PAIR(2); dotcolor = COLOR_PAIR(2);
@ -547,6 +548,7 @@ main(int argc, char **argv)
strncpy(ttyclock.option.format, "%F", sizeof (ttyclock.option.format)); strncpy(ttyclock.option.format, "%F", sizeof (ttyclock.option.format));
/* Default color */ /* Default color */
ttyclock.option.color = COLOR_GREEN; /* COLOR_GREEN = 2 */ ttyclock.option.color = COLOR_GREEN; /* COLOR_GREEN = 2 */
ttyclock.option.alt_color = 100; /* COLOR_GREEN = 2 */
/* Default delay */ /* Default delay */
ttyclock.option.delay = 1; /* 1FPS */ ttyclock.option.delay = 1; /* 1FPS */
ttyclock.option.nsdelay = 0; /* -0FPS */ ttyclock.option.nsdelay = 0; /* -0FPS */
@ -554,7 +556,7 @@ main(int argc, char **argv)
atexit(cleanup); atexit(cleanup);
while ((c = getopt(argc, argv, "iuvsScbtrhBxnDC:f:d:T:a:")) != -1) while ((c = getopt(argc, argv, "iuvsScbtrhBxnDX:C:f:d:T:a:")) != -1)
{ {
switch(c) switch(c)
{ {
@ -566,6 +568,7 @@ main(int argc, char **argv)
" -x Show box \n" " -x Show box \n"
" -c Set the clock at the center of the terminal \n" " -c Set the clock at the center of the terminal \n"
" -C [0-7] Set the clock color \n" " -C [0-7] Set the clock color \n"
" -X [0-7] Set the alternate clock color \n"
" -b Use bold colors \n" " -b Use bold colors \n"
" -t Set the hour in 12h format \n" " -t Set the hour in 12h format \n"
" -u Use UTC time \n" " -u Use UTC time \n"
@ -609,6 +612,10 @@ main(int argc, char **argv)
if(atoi(optarg) >= 0 && atoi(optarg) < 8) if(atoi(optarg) >= 0 && atoi(optarg) < 8)
ttyclock.option.color = atoi(optarg); ttyclock.option.color = atoi(optarg);
break; break;
case 'X':
if(atoi(optarg) >= 0 && atoi(optarg) < 8)
ttyclock.option.alt_color = atoi(optarg);
break;
case 't': case 't':
ttyclock.option.twelve = True; ttyclock.option.twelve = True;
break; break;
@ -656,6 +663,9 @@ main(int argc, char **argv)
} }
} }
if ( ttyclock.option.alt_color == 100) {
ttyclock.option.alt_color = ttyclock.option.color;
}
init(); init();
attron(A_BLINK); attron(A_BLINK);
while(ttyclock.running) while(ttyclock.running)

@ -80,6 +80,7 @@ typedef struct
Bool noquit; Bool noquit;
char format[100]; char format[100];
int color; int color;
int alt_color;
Bool bold; Bool bold;
long delay; long delay;
Bool blink; Bool blink;

Loading…
Cancel
Save