为什么领先的“#FF”在十六进制颜色值? [英] Why the leading "#FF" in hexadecimal color values?
问题描述
我有一个已经转换的RGB颜色列表以十六进制。我只需要将十六进制值插入到我的XAML中。
最初,我将来自电子邮件的十六进制值粘贴到适当的属性中。在我完成之前,Blend开始适应,突出显示颜色属性,并用一个工具提示告诉我令牌无效。经过一番研究后,我发现在十六进制值前面加上一个英镑符号(#)解决了这个问题。
在研究这个问题的过程中,我开始通过Blend中的颜色选择器改变颜色。我很快发现Blend插入的值不仅以磅符号开始,而且还以FF开头。我正在粘贴的值是有效的十六进制格式的有效颜色。但是,当将RGB值输入到Blend并让Blend插入十六进制值时,我注意到所有mycolors都以#FF作为前缀。正如我已经指出的那样,删除#会产生错误,但是删除FF将根本没有任何效果。
在十六进制颜色的世界里,颜色#5A7F39真的和#FF5A7F39一样吗?为什么FF?他们是两个不同的十六进制值,对吗?但在屏幕上显示完全相同。为什么区别?
这可能是颜色的alpha分量,代表不透明度(00-> transparent,FF - > opaque)。
MSDN似乎同意这一点: http://msdn.microsoft.com/en-us/library/bb980062(VS.95).aspx
16位十六进制,alpha - #AARRGGBB
I'm using Expression Blend 3 and writing some of the XAML by hand, specifically the color values of controls.
I have a list of RGB colors already converted to hexadecimal. I just need to insert the hex value into my XAML.
Initially, I pasted the hex value from an email into the appropriate properties. Before I could finish, Blend started having a fit, underlining the color property with a squiggle and a tooltip telling me "Token is not valid." After some research, I found placing a pound sign ("#") in front of the hex value resolved this issue.
In the process of researching this problem, I started chaning colors via the color picker in Blend. I quickly found the values Blend was inserting not only started with the pound sign but also "FF". The values I was pasting were valid colors in valid hex format. But when entering the RGB values into Blend and letting Blend insert the hex value, I noticed all mycolors were prefixed with "#FF". Removing the #, as i already pointed out, generated errors but removing the "FF" seamed to have no effect at all.
In the world of hexadecimal colors, is the color #5A7F39 really the same as #FF5A7F39 ? Why the FF ? They are two different hex values, right? But appear identical onscreen. Why the difference?
That may be the alpha component of the color, which represents the opacity (00 -> transparent, FF -> opaque).
MSDN seems to agree with this : http://msdn.microsoft.com/en-us/library/bb980062(VS.95).aspx
16-bit hexadecimal, alpha -- #AARRGGBB
这篇关于为什么领先的“#FF”在十六进制颜色值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!