css - Reverse hex to rgba() to get necessary opacity for overlaying colors -
let's have 2 similar hexadecimal colors: #7a82f1
, #a1a6f4
respective rgb(122, 130, 241)
, rgb(161, 166, 244)
. let's assume second color can achieved in child element setting css add white (with variable opacity) on top of parent color (the first color).
is there way "reverse rgba" find opacity on white (or black) can applied on 1 color other? example:
.parent { background: #7a82f1; .child { background: rgba(255, 255, 255, 0.3); //this #a1a6f4! however, how find out 0.3 without knowing it? } }
the purpose able work off png/jpeg designs rather dealing intricacies of psd files (or having hand off own).
assume that
- background black.
- the channel linear (0-255), 0=black (background) , 255=foreground
- the grayscale linear (0-255), 0=black , 255=white
then gray 35 @ opacity 255 same gray 52 @ opacity 255*35/52 = 171.
but these assumptions dubious. in games programming using float values colours , transparency , control on gamma curve easier. in css, not much.
Comments
Post a Comment