I have a design:
I want to have 2 svg polygons that overlap. Is it possible to have polygon 2, when overlapping other elements, creates a darker color and while overlapping white creates the same color as the non-opaque elements?
UPDATE
The markup is irrelevant because I'm just interested in the color values. I want to know the color value with an opacity value (alpha) that matches rgb(0, 92, 150)
when the background color is white.
body {
background: white;
}
.container {
background: rgb(0, 92, 150);
}
.polygon-1 {
fill: rgb(0, 92, 150);
}
.polygon-2 {
fill: [a color value that has an alpha that, when it's over white, creates the same color as rgb(0, 92, 150) and creates the darker color effect when it overlays rgb(0, 92, 150)];
}
I guess this question is essentially the same as mine.
According to the JS solution provided in that question, it takes the lowest number of the rgb to calculate the alpha. In my case, it's 0. The generated rgba
value is rgba(0, 92, 150, 1)
(no opacity). Does this mean that that particular color cannot create the desired effect?
var min, a = (255 - (min = Math.min(r, g, b))) / 255;
In my case, Math.min(0, 92, 150)
is 0
, (255 - 0) / 255
is 1, so my alpha value turns out to be 1. I need it to be less than 1 (at least a little bit).
UPDATE 2
To further question downvotes, here is a crude codepen to illustrate my point.