Modify

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...)

Attachments (1)

Screenshot.png (15.1 KB ) - added by goodidea 2 months ago.

Download all attachments as: .zip

Change History (1)

by goodidea, 2 months ago

Attachment: Screenshot.png added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to goodidea.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.