Opened 2 months ago
#24529 new enhancement
[MapCSS] How to check for non-valid color values?
| Reported by: | goodidea | Owned by: | team |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Core | Version: | |
| Keywords: | Cc: |
Description
A question or problem: I would like to check in MapCSS if a value for a color property is valid. But I can't find a way to do it...
Example and clarification of the problem:
- The color “lightred” is not part of the “Extended color keywords” (see https://www.w3.org/TR/css-color-3/#svg-color).
- I there is a MapCSS styling like
symbol-shape: circle; symbol-fill-color: eval(tag(colour));(for example to draw a colored circle behind an icon on a separate layer – for a node with a colour tag), this circle will get the JOSM standard color “blue” (for symbols; see MapCSS documentation)! - And the Java console throws a warning.: “WARNING: Unable to convert property symbol-fill-color to type class java.awt.Color: found lightred of type class java.lang.String!”
In such a case, I would like to catch the incorrect display of the circle (symbol-shape) in blue with MapCSS (and possibly display a warning for an incorrect color value using MapCSS styling – or define this as a validator rule).
I haven't found anything about this in the MapCSS documentation. Is there a way to do this besides a complex regular expression that tests all Extended Color values plus the other possible notations for a "color" property value that I might have overlooked, perhaps using the implemented Java functions?
Or could a new function be defined for this, e.g., is_valid(<color property>)?
(I don't know if "core mappaint" should be set as a component for this problem...)


