admin管理员组文章数量:1425703
I have a color code, for example #EB5757
which is a kind of red. I want to add opacity to it 0.15
or 15%. After looking on this question I saw in the accepted answer that for 15% one must add 26
at the beginning.
So I did it: #26EB5757
but now the resulted color is not a red with opacity but a green. I'm using this in Javascript/React if this information is useful.
style = {backgroundColor: '#26EB5757'}
Any ideas on how to set that original red color to be opaque?
I have a color code, for example #EB5757
which is a kind of red. I want to add opacity to it 0.15
or 15%. After looking on this question I saw in the accepted answer that for 15% one must add 26
at the beginning.
So I did it: #26EB5757
but now the resulted color is not a red with opacity but a green. I'm using this in Javascript/React if this information is useful.
style = {backgroundColor: '#26EB5757'}
Any ideas on how to set that original red color to be opaque?
Share Improve this question asked Apr 28, 2020 at 11:42 Leo MessiLeo Messi 6,25622 gold badges80 silver badges155 bronze badges2 Answers
Reset to default 48 digit hexadecimal color notation in CSS has the following format:
#RRGGBBAA
RR - red
GG - green
BB - blue
AA - alpha
You should use:
#EB575726 (for your 15% red)
I guess you can use convertor to get actual RGB representation of that HEX. You may try this one
Then you can simple add your opacity into rgba
like this use backgroundColor: rgba(235,87,87, 0.15)
本文标签: javascriptAdd opacity to hex representation of colorStack Overflow
版权声明:本文标题:javascript - Add opacity to hex representation of color - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745455750a2659093.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论