I have an element(<div>
) with transparent background color: rgba(96, 96, 96, .1)
and I assume my element has a wrapper with white background.
Is there any way to convert transparent color to hex using LESS css? For example, rgba(96, 96, 96, .1)
should be equal to #efefef
.
I've read the color function article, but have not found a suitable answer.
If I understand the question correctly you're looking for a function that calculates result of compositing/layering of one color (e.g. rgba(96, 96, 96, .1)
) with/over another (e.g. white
). In Less it's supposed to be one of the blending functions family, but since the name of such function in current naming convention has to be normal
(which is rather weird) this function is not included. But if one of colors is always white
you still can get the desired result via multiply
:
multiply(white, rgba(96, 96, 96, .1))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With