白色用rgba怎么设置html,转换RGB到RGBA的白色
Mark Kahn提出了一個問題:Convert RGB to RGBA over white,或許與您遇到的問題類似。
回答者Guffa給出了該問題的處理方式:
Take the lowest color component, and convert that to an alpha value. Then scale the color components by subtracting the lowest, and dividing by the alpha value.
Example:
152 converts to an alpha value of (255 - 152) / 255 ~ 0.404
152 scales using (152 - 152) / 0.404 = 0
177 scales using (177 - 152) / 0.404 ~ 62
202 scales using (202 - 152) / 0.404 ~ 123
So, rgb(152, 177, 202) displays as rgba(0, 62, 123, .404).
I have verified in Photoshop that the colors actually match perfectly.
希望本文對你有幫助,歡迎支持JavaScript中文網
總結
以上是生活随笔為你收集整理的白色用rgba怎么设置html,转换RGB到RGBA的白色的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 手势识别iOS
- 下一篇: DISC四种领导风格