sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

sent-invertedcolors-72d33d4.diff (1683B)


      1 diff --git a/config.def.h b/config.def.h
      2 index 60eb376..ccea9a6 100644
      3 --- a/config.def.h
      4 +++ b/config.def.h
      5 @@ -13,6 +13,11 @@ static const char *colors[] = {
      6  	"#FFFFFF", /* background color */
      7  };
      8  
      9 +static const char *inverted_colors[] = {
     10 +	"#FFFFFF", /* foreground color */
     11 +	"#000000", /* background color */
     12 +};
     13 +
     14  static const float linespacing = 1.4;
     15  
     16  /* how much screen estate is to be used at max for the content */
     17 diff --git a/sent.1 b/sent.1
     18 index fabc614..f74d583 100644
     19 --- a/sent.1
     20 +++ b/sent.1
     21 @@ -6,6 +6,7 @@
     22  .Sh SYNOPSIS
     23  .Nm
     24  .Op Fl v
     25 +.Op Fl i
     26  .Op Ar file
     27  .Sh DESCRIPTION
     28  .Nm
     29 @@ -21,6 +22,8 @@ few minutes.
     30  .Bl -tag -width Ds
     31  .It Fl v
     32  Print version information to stdout and exit.
     33 +.It Fl i
     34 +Use the colors from the inverted color array.
     35  .El
     36  .Sh USAGE
     37  .Bl -tag -width Ds
     38 diff --git a/sent.c b/sent.c
     39 index c50a572..c31f772 100644
     40 --- a/sent.c
     41 +++ b/sent.c
     42 @@ -25,6 +25,8 @@
     43  
     44  char *argv0;
     45  
     46 +int use_inverted_colors = 0;
     47 +
     48  /* macros */
     49  #define LEN(a)         (sizeof(a) / sizeof(a)[0])
     50  #define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x)
     51 @@ -586,7 +588,11 @@ xinit()
     52  
     53  	if (!(d = drw_create(xw.dpy, xw.scr, xw.win, xw.w, xw.h)))
     54  		die("sent: Unable to create drawing context");
     55 -	sc = drw_scm_create(d, colors, 2);
     56 +	if (use_inverted_colors) {
     57 +		sc = drw_scm_create(d, inverted_colors, 2);
     58 +	} else {
     59 +		sc = drw_scm_create(d, colors, 2);
     60 +	}
     61  	drw_setscheme(d, sc);
     62  	XSetWindowBackground(xw.dpy, xw.win, sc[ColBg].pixel);
     63  
     64 @@ -687,6 +693,9 @@ main(int argc, char *argv[])
     65  	case 'v':
     66  		fprintf(stderr, "sent-"VERSION"\n");
     67  		return 0;
     68 +	case 'i':
     69 +		use_inverted_colors = 1;
     70 +		break;
     71  	default:
     72  		usage();
     73  	} ARGEND