Why does the brush have only 3 hex values?

For example, this page has code, for example:

<SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" /> 

Why does the color property only have 3 hexadecimal values? Doesn't color usually have 6 or 8 hexadecimal values? (e.g. Fill = "# FF0000FF") What does 3 hex mean? mean?

+4
source share
3 answers

Brush colors can be specified in hexadecimal notation with three, four, six, or eight digits, as shown on the MSDN page for SolidColorBrush :

 <object property="#rgb"/> - or - <object property="#argb"/> - or - <object property="#rrggbb"/> - or - <object property="#aarrggbb"/> 

#rgb expands to #rrggbb (as in the CSS hexadecimal notation), and #argb expands to #aarrggbb . Using three or six digits, alpha is always maximized. That is, they 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" /> 
+8
source

If you use a three-digit value, each digit is automatically doubled, so #AAA equivalent to #AAAAAA and #123 = #112233

+3
source

Your example FF0000FF represents 4 Hex values ​​(a tuple) that represent 4 bytes (RGBA). The term #AAA is a short meaning. #AAA equals #AAAAAA equals #FFAAAA

0
source

All Articles