Skip to content

Commit

Permalink
C color code: Ignore alpha component (FS#966)
Browse files Browse the repository at this point in the history
The only place where we silently have to ignore alpha components are window
borders and systray background. However, because these color strings could be
coming from the beautiful theme, we shouldn't error out when an alpha component
is present.

With this commit, we silently ignore this alpha component.

Signed-off-by: Uli Schlachter <psychon@znc.in>
  • Loading branch information
psychon committed Apr 7, 2012
1 parent 5c7a350 commit 00059d2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions color.c
Expand Up @@ -46,6 +46,13 @@ color_parse(const char *colstr, ssize_t len,
char *p;

colnum = strtoul(colstr + 1, &p, 16);
if(len == 9 && (p - colstr) == 9)
{
/* We ignore the alpha component */
colnum >>= 8;
len -= 2;
p -= 2;
}
if(len != 7 || colstr[0] != '#' || (p - colstr) != 7)
{
warn("awesome: error, invalid color '%s'", colstr);
Expand Down

0 comments on commit 00059d2

Please sign in to comment.