summaryrefslogtreecommitdiff
path: root/src/parse/properties/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse/properties/utils.c')
-rw-r--r--src/parse/properties/utils.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c
index 85c0e2d..860712d 100644
--- a/src/parse/properties/utils.c
+++ b/src/parse/properties/utils.c
@@ -628,7 +628,6 @@ css_error css__parse_colour_specifier(css_language *c,
goto invalid;
/* have a valid HSV entry, convert to RGB */
-
HSL_to_RGB(hue, sat, lit, &r, &g, &b);
/* apply alpha */
@@ -821,17 +820,23 @@ css_error css__parse_named_colour(css_language *c, lwc_string *data,
bool match;
for (i = FIRST_COLOUR; i <= LAST_COLOUR; i++) {
- if (lwc_string_caseless_isequal(data, c->strings[i],
- &match) == lwc_error_ok &&
- match)
+ if (lwc_string_caseless_isequal(data, c->strings[i],
+ &match) == lwc_error_ok && match)
break;
}
- if (i == LAST_COLOUR + 1)
- return CSS_INVALID;
- *result = colourmap[i - FIRST_COLOUR];
+ if (i <= LAST_COLOUR) {
+ /* Known named colour */
+ *result = colourmap[i - FIRST_COLOUR];
+ return CSS_OK;
+ }
+
+ /* We don't know this colour name; ask the client */
+ if (c->sheet->color != NULL)
+ return c->sheet->color(c->sheet->color_pw, data, result);
- return CSS_OK;
+ /* Invalid colour name */
+ return CSS_INVALID;
}
/**