叼花硬汉 2013-04-06 14:30 采纳率: 0%
浏览 357
已采纳

颜色十六进制透明[复制]

This question already has an answer here:

I'm working on implementing a widget transparency option for my app widget although I'm having some trouble getting the hex color values right. Being completely new to hex color transparency I searched around a bit although I couldn't find a specific answer to my question.

I want to set transparency by hex color so let's say my hex color id "#33b5e5" and I want it to be 50% transparent. Then I'll use "#8033b5e5" because 80 is 50%.

I found a useful chart here: http://www.dtp-aus.com/hexadeci.htm . With this data I managed to come up with this:

0% = #00
10% = #16
20% = #32
30% = #48
40% = #64
50% = #80
60% = #96
70% = #112
80% = #128
90% = #144

Now the issues start appearing when I get higher than 100 in hex. Hex color codes can only be 8 symbols long right? For example #11233b5e5 (80%) crashes.

What can I do to enable me to use the higher numbers aswell?

</div>

转载于:https://stackoverflow.com/questions/15852122/hex-transparency-in-colors

  • 写回答

10条回答 默认 最新

  • 七度&光 2013-06-21 16:15
    关注

    Here's a correct table of percentages to hex values. E.g. for 50% white you'd use #80FFFFFF.

    • 100% — FF
    • 95% — F2
    • 90% — E6
    • 85% — D9
    • 80% — CC
    • 75% — BF
    • 70% — B3
    • 65% — A6
    • 60% — 99
    • 55% — 8C
    • 50% — 80
    • 45% — 73
    • 40% — 66
    • 35% — 59
    • 30% — 4D
    • 25% — 40
    • 20% — 33
    • 15% — 26
    • 10% — 1A
    • 5% — 0D
    • 0% — 00

    (source)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(9条)

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c