geostyler / geostyler-openlayers-parser

GeoStyler Style Parser implementation for OpenLayers styles
BSD 2-Clause "Simplified" License
38 stars 29 forks source link

[openlayers-parser] Color-handling bug #205

Open jansule opened 5 years ago

jansule commented 5 years ago

PARSER

OPENLAYERS

BUG

Description:

Currently, the parser cannot handle the hsl format if also the opacity was specified, since it wrongly assumes the color to be formatted as hexcode. This results in displaying wrong colors.

openlayers-parser assumes colors are formatted as rgba or hexcodes but actually ol supports more than that, e.g. hsl. Instead of transforming color formats the parser should rather only split/merge color-opacities but keep the original format.

Example:

geostyler-style: {
    color: 'hsl(120, 100%, 50%)',
    opacity: 0.5
}

<==>

olStyle: {
    color: 'hsla(120, 100%, 50%, 0.5)'
}

related to geostyler/geostyler#848

KaiVolland commented 5 months ago

The geostyler-style always expects hex values. But we could consider to remind the colorformat in the metadata and add some functions to restore the previous format.