Translucent colour over texture doesn't work right? #258

Closed
stevage opened this Issue Mar 4, 2013 · 8 comments

5 participants

@stevage


#waterpoly {
polygon-pattern-file:url('https://dl.dropbox.com/u/767553/OSM/greytexture.jpg');
over/polygon-fill: @seawater;
//over/polygon-opacity: 10%
over/polygon-opacity:90%
line-color: darken(@seawater,40%);
line-width:2;
line-opacity:40%;
}

In this example, with opacity at 90%, the dark grey texture can just be seen through the blue 'over' layer. At 10%, all you see is the blue, with no hint of texture.

Maybe I'm misunderstanding, but this seems the opposite of what I expected.

@ajashton
Mapbox member

Opacity styles take a number between 0 and 1. Use over/polygon-opacity: 0.1; for 10% opacity.

@stevage

Yes, decimals work as expected. But, there is still something weird here:

  • 0 -> 1: 0 is invisible, 1 is solid
  • 1.01 -> 256: 1 is solid, 256 is invisible
  • (repeats, 256.1 -> 512 etc)
  • 0%..100%: 0% is solid, 100% is invisible.

IMHO, percentage opacities should work.

@tmcw
Mapbox member

IMHO, percentage opacities should work.

percentages are not supported in CSS, so I'm not inclined to make them work in Carto.

@stevage

Or they should generate an error maybe. Currently, reasonable user behaviour is met by undefined results which some of the time (around the 50% mark) works as expected. Anyway, nuff said.

@tmcw
Mapbox member

Yes, decimals work as expected. But, there is still something weird here:

There's nothing weird with % - the behavior is very simple, the % is removed in parsing, just like px. Besides that, it's just Mapnik's intepretation of out-of-range opacity values, which is, in turn, agg's handling of out-of-range opacity values. Not seeing much reason to add more code here to compensate for guessed syntax.

@tmcw
Mapbox member

% added in 0f65b86

@tmcw tmcw closed this Apr 15, 2013
@yhahn
Mapbox member

This change breaks all previous instances of lighten(), darken() etc. which were interpreting the second arg as a percent without any dimensional unit.

Prior carto like:

lighten(@water,15);

Would need to be rewritten like:

lighten(@water,15%);
lighten(@water,0.15);

I do not think this tradeoff (break all prior carto that uses color transform functions) is worth this feature addition, especially when those familiar with CSS would not expect the feature anyway.

Recommendation: revert.

@yhahn yhahn reopened this Jun 14, 2013
@ian29
Mapbox member

I do not think this tradeoff (break all prior carto that uses color transform functions) is worth this feature addition, especially when those familiar with CSS would not expect the feature anyway.

+1

@yhahn yhahn added a commit that referenced this issue Jun 14, 2013
@yhahn yhahn Revert "Dimensions." Refs #258.
This reverts commit 0f65b86.
ff0fc2b
@yhahn yhahn closed this Jun 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment