Filter: invert ... get color?

So i’ve got a page with a filter:invert(1) on it.
Can i derive what the hex value of the inverted color is? I like the look of some of the inverted colors, but not others, and would like to replicate the inverted values of some elements without filtering everything.

IE: The page will tell me the background is #f1ebe8eb. What’s the invert(1) of #f1ebe8eb? Is it just 0xFF-(R) 0xFF-(G) 0xFF-(B) A?

Yes, for the RGB part (see https://drafts.fxtf.org/filter-effects/#invertEquivalent)

For the transparency, I couldn’t find any info and twiddling with some values didn’t help any, sorry.

So…if i’m understanding it right… for an invert(X), X = [0,1] it would be…
R = 0xFF * (1 - (X * R / 0xFF))
(repeat for G and B)

EDIT: No, thats not right Marc…

Assuming 0 <= R <= 255, then all that just boils down to your original: R’ = 255-R, wouldn’t it?
[oh wait, dumb answer. I didn’t read your comment correctly]

By the way, I did confirm (sticking the images in Photoshop and looking at the rgb values) that on a white background the transparency value holds as is, again just like your original guess. I did not try this on a colored background or with any more than just your one example color :slight_smile:

That’s true for X = 1; but need to figure out the formula for a generic X.

Basically, for a given R (R = hex / 255), and a given X ([0,1]), find the X% value from [R, 1-R].

My maths brain is refusing to cooperate on a saturday.

The range width (W) is (R - (1-R)).
(X*W)+R?
Formula only works if you know which of the values is smaller…

See if this works:
Let R = original color component, say Red
Let R’ = 100% inverted color = abs (R-255)
Let R’’ = color component using invert(i) = (1-i)R+iR’