ARTICLE AD BOX
[Note: I am using this to make the opaque parts of an input (the text) fully transparent and the semi-transparent parts of the same input (the background around the text) fully opaque.]
Consider an element with a background with a low alpha:
body { --c: #00171f } div { --a: .07; background: rgb(from var(--c) r g b/ var(--a)) }This element gets an SVG filter that should make all alphas smaller or equal to .2 be equal to 1 via feComponentTransfer.
That's all the filter is supposed to do, map the [0, 1] input alpha interval to [1.25, 0]. You can see this mapping and its clamped version equivalent graphed below.

The SVG filter itself looks as follows:
<svg height='0'> <filter id='extract' x='0' y='0' width='1' height='1'> <feComponentTransfer> <feFuncA type='table' tableValues='1.25 0'/> </feComponentTransfer> </filter> </svg>How I thought it would work: it would recover the opaque --c RGB values.
How it actually works: it returns somewhat different RGB values in all browsers. Something is at play here and I don't understand what. Why is this changing the RGB channels?
Why does the amount of change vary non-linearly with the alpha? Try to tweak the alpha to see the changes. A value of .05 brings me closer to the original RGB, and so do values between .2 or .1, whereas a value of .01 gives me pretty much black, a value of .2 pretty much blue.
This is what I get in Chrome:

And this is what I get in Firefox - almost the same but not exactly, look at .02 and .2:

Setting color-interpolation-filters='sRGB' on the filter doesn't seem to have any effect.
Things get kookier when I set the alpha via an opacity() filter, that is:
div { --a: .07; background: var(--c); filter: opacity(var(--a)) url(#extract) }In this case, in Chrome, I get the same result #00161c (slightly different from the original #00171f) for all bars without color-interpolation-filters='sRGB' and the correct result for all bars regardless of alpha with color-interpolation-filters='sRGB'.
In Firefox however, I get the the exact same result as before when setting the alpha on the background. Setting the alpha via an opacity() filter makes no difference whatsoever and neither does the color-interpolation-filters value.
I'm on Linux, so I cannot test in actual Safari, but Epiphany seems to behave the same as Firefox.
Using the opacity property produces the same result as the alpha on the background case.
Using the opacity() filter on a child and then the SVG filter on a parent produces the same result as the alpha on the background case.
Here's a test snippet.
