summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-12-15 20:57:07 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-12-15 20:57:07 +0100
commita5a5427fff40bce8affc60c0eb7213d9c0c06dd3 (patch)
treeda6b92c9311bad40f0133a3ef5d97451ff636021
parentcce1eb34d191949cec25440a36b2477f3b3a8fe5 (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.
-rw-r--r--src/colors.c5
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;