For example, in this page there is code such as:
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" />
Why does the color property only have 3 hex value? Doesn't color normally have 6 or 8 hex value? (like Fill="#FF0000FF") What does the 3 hexes means? mean?
Brush colors may be specified in hex notation with three, four, six or eight digits as shown in the MSDN page for SolidColorBrush
:
<object property="#rgb"/>
- or -
<object property="#argb"/>
- or -
<object property="#rrggbb"/>
- or -
<object property="#aarrggbb"/>
#rgb
expands to #rrggbb
(like it does in CSS hex notation), and #argb
expands to #aarrggbb
. Using three or six digits, the alpha is always maxed out. That is, these are all equivalent:
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" />
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#FAAA" />
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAAAAA" />
<SolidColorBrush x:Key="DisabledBorderBrush" Color="#FFAAAAAA" />
If you use a 3 digit value, each digit is automatically doubled, so #AAA
is equivalent to #AAAAAA
and #123
= #112233
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With