问题描述
我正在使用 Expression Blend 3,并且正在手工编写一些XAML,特别是控件的颜色值.
I'm using Expression Blend 3 and am writing some of the XAML by hand, specifically the color values of controls.
我有一个已经转换为十六进制的RGB颜色列表.我只需要在我的XAML中插入十六进制值即可.
I have a list of RGB colors already converted to hexadecimal. I just need to insert the hex value into my XAML.
最初,我将电子邮件中的十六进制值粘贴到适当的属性中.在我完成之前,Blend开始适应,用一个花样和一个工具提示强调color属性,并告诉我令牌无效".经过一番研究,我发现在十六进制值之前放置一个井号(#")可以解决此问题.
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.
在研究此问题的过程中,我开始通过Blend中的颜色选择器更改颜色.我很快发现Blend插入的值不仅以英镑符号开头,而且还以"FF"开头.我粘贴的值是有效十六进制格式的有效颜色.但是,当将RGB值输入Blend并让Blend插入十六进制值时,我注意到我所有的颜色都以"#FF"为前缀.如我已经指出的,删除#
会产生错误,但是删除"c"会导致错误.似乎根本没有效果.
In the process of researching this problem, I started changing 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 a valid hex format. But when entering the RGB values into Blend and letting Blend insert the hex value, I noticed all my colors were prefixed with "#FF". Removing the #
, as I already pointed out, generated errors, but removing the "FF" seemed to have no effect at all.
在十六进制颜色的世界中,#5A7F39颜色真的与#FF5A7F39 相同吗?为什么是 FF ?它们是两个不同的十六进制值,对吗?但是它们在屏幕上看起来完全相同.为什么会有所不同?
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 they appear identical onscreen. Why the difference?
推荐答案
这可能是颜色的Alpha成分,代表了不透明度(00->透明,FF->不透明).
That may be the alpha component of the color, which represents the opacity (00 -> transparent, FF -> opaque).
MSDN似乎对此表示同意: 颜色
MSDN seems to agree with this: Color
这篇关于为什么会有一个开头的"#FF"十六进制颜色值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!