I am working on a project and I want it to get the transparent color but getting the color from the backend and make it rbga code and then setting the alpha parameter to 0.3. But making this the div I am making is being transparent. Is there a way to get that color without making the div transparent. For exemple from the backend I get the color: #A79B8E But I want the background to be: #DCD7D2. Which is #A79B8E but with the opacity of 0.4. When I do it the component using the new color seems to be a little bit transparent. In this picture you can see that Color2 divs are somehow transparent:
Asked
Active
Viewed 313 times
1
-
2Saying _"#DCD7D2. Which is #A79B8E but with the opacity of 0.4"_ makes rather little sense to begin with. What #A79B8E with opacity 0.4 _actually_ results in, depends of course on what color the content _behind_ it actually has. – CBroe Jun 08 '22 at 11:38
-
@CBroe I guess I meant Opacity on white background. sorry for not mentioning that. Do you think the best thing I can do here is to add another div with a white background behind the div I want to create ? – Nag Jun 08 '22 at 11:40
-
Well the background is obviously _not_ white in those parts. Only way to do this using opacity, would be to wrap those elements into another one that _has_ a pure white background. If that is not an option, then you will have to _calculate_ what actual color value #A79B8E with .4 opactiy "on white" results in - and then use that _RGB_ value, without any opacity. – CBroe Jun 08 '22 at 11:46
-
1highly related if not a duplicate - https://stackoverflow.com/questions/12228548/finding-equivalent-color-with-opacity – Paulie_D Jun 08 '22 at 11:59
-
I don’t understand this: “#DCD7D2. Which is #A79B8E but with the opacity of 0.4”. Both those hex colors have opacity 1. Is there some confusion with HSL parameters and hue rotation perhaps? – A Haworth Jun 08 '22 at 12:02