diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-12-15 20:57:07 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-12-15 20:57:07 +0100 |
commit | a5a5427fff40bce8affc60c0eb7213d9c0c06dd3 (patch) | |
tree | da6b92c9311bad40f0133a3ef5d97451ff636021 /src/colors.c | |
parent | cce1eb34d191949cec25440a36b2477f3b3a8fe5 (diff) |
fix parsing of 3-digit colors (#RGB)
Digits need to be replicated not filled with zeros.
E.g #FFF is the same as #FFFFFF not #F0F0F0.
Diffstat (limited to 'src/colors.c')
-rw-r--r-- | src/colors.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/colors.c b/src/colors.c index ea1c3391..6a684dde 100644 --- a/src/colors.c +++ b/src/colors.c @@ -221,8 +221,9 @@ static int32_t Color_parse_hex (const char *s, int32_t default_color, int *err) *err = 0; else if (tail - s == 3) { /* #RGB as allowed by CSS */ *err = 0; - ret_color = ((ret_color & 0xf00) << 12) | - ((ret_color & 0x0f0) << 8) | ((ret_color & 0x00f) << 4); + ret_color = ((ret_color & 0xf00) << 12) | ((ret_color & 0xf00) << 8) | + ((ret_color & 0x0f0) << 8) | ((ret_color & 0x0f0) << 4) | + ((ret_color & 0x00f) << 4) | ((ret_color & 0x00f) << 0); } else ret_color = default_color; |