Skip to content

Commit

Permalink
alpha: support 0-255 value scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
neeasade committed Jul 3, 2020
1 parent 2835b9f commit 2c7fd09
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions x.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,11 @@ xloadcols(void)
/* set alpha value of bg color */
if (opt_alpha)
alpha = strtof(opt_alpha, NULL);

/* xst: if alpha value is above 1.0, assume it's a number in the 255 range, normalize it */
if (alpha > 1.0)
alpha = alpha / 255;

dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha);
dc.col[defaultbg].pixel &= 0x00FFFFFF;
dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24;
Expand Down

0 comments on commit 2c7fd09

Please sign in to comment.