mapbox/carto

v0.16.x regression in color math

springmeyer opened this issue · 4 comments

@water: #a0c8f0;

#water {
  polygon-fill: @water - #111;
}

This gives #8fb7df in carto v0.15.x and #838383 in carto v0.16.x

/cc @nebulon42 - any idea what might have caused this change?

Yes, there were two things: First, it was possible that the hue value was NaN for greyscale colours, which led to unexpected results in the math operation. Second, math operations on colours have to be done in RGB for backwards compatibility.

Fixed now.

fwiw, I'm not sure that subtracting one color from another and rendering the result makes sense. When you subtract colours you get a colour difference, which you could then add to another colour. The semantics of this are similar to datetimes and intervals

Great work, thank you @nebulon42! Just published v0.16.2.