Reading-eScience-Centre / edal-java

Environmental Data Abstraction Layer libraries
Other
39 stars 30 forks source link

Support transparency (8 digit hex code:) for categorical variables? #79

Closed rsignell-usgs closed 7 years ago

rsignell-usgs commented 7 years ago

I was wondering to specify a transparent value for one of my category values to ncWMS, and found this discussion of an 8-digit specification: http://stackoverflow.com/a/39718004

The first 6 digits are interpreted identically to the 6-digit notation. The last pair of digits, interpreted as a hexadecimal number, specifies the alpha channel of the color, where 00 represents a fully transparent color and ff represent a fully opaque color.

So a specification of #0000ffcc represents the same color as rgba(0, 0, 100%, 80%) (a slightly-transparent blue).

Could this be used in ncWMS?

Or is there another way to specify transparent color?

guygriffiths commented 7 years ago

Hmm, we implemented something like this for ncWMS quite a while ago but used #AARRGGBB, rather than #RRGGBBAA. That's the current way of doing it.

But if the #RRGGBBAA is becoming more standard, perhaps we should switch to that? @jonblower - any thoughts?

guygriffiths commented 7 years ago

Just had a browse of the code and changing formats now is a definite no. ncWMS writes out the full 8-digit notation into config files so changing it would break existing configs.

Also, a quick Google suggests that the term #AARRGGBB occurs about twice as often as #RRGGBBAA, so it doesn't seem like it's been standardised in any way, but we're using the most common representation.

rsignell-usgs commented 7 years ago

@guygriffiths, this is great!

I certainly don't care about how transparency is specified, I just didn't even know that it was a possibility!

I was looking at the documentation on categorical data: https://reading-escience-centre.gitbooks.io/ncwms-user-guide/content/05-data_formats.html#categorical where all the examples use the 6 digit #RRGGBB colors, and didn't even look at the section on colour palettes, where you describe the 8 digit #AARRGGBB colors with transparency.

My endpoint is working as I want it to now: 2017-01-19_7-26-30