在颜色的十六进制透明度透明度、颜色、十六进制

2023-09-11 11:30:53 作者:Chilly breeze

我工作的实施wigdget透明度的选择我的应用程序插件,虽然我有一些麻烦的十六进制颜色值的权利。作为完全新的十六进制颜色透明我搜索了一下周围,虽然我无法找到一个具体的回答我的问题。

I'm working on implementing a wigdget 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.

我要设置由十六进制颜色透明度,所以我们可以说我的十六进制颜色ID#33b5e5,我希望它是50%透明。然后,我将使用#8033b5e5,因为80是50%。

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%.

我发现了一个有用的图在这里: http://www.dtp-aus.com/hexadeci.htm。有了这个数据我设法想出这样的:

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

现在的问题开始出现的时候,我得到100六角高于。十六进制颜色codeS只能是8个符号长吧?例如#11233b5e5(80%)崩溃。

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?

推荐答案

下面的百分比,以十六进制值的正确的表。例如。 50%的白,你会用#80FFFFFF。

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 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

(源)