WPF Transparent Colors

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

I was playing with transparent colors and was wondering why:

#50C6 is transparent (Light green)
#50C6C6 is not transparent (Light Blue)
#50C6C6C6 is transparent (Light Gray)

I had been told the format was #00xxxxxx, but the first one is not in that
format so why is it transparent?

Thanks,

Tom
 
Hello,

I gave this a try and it seems that #ABCD is taken as #AABBCCDD. So IMO your
best bet is to always use 6 or 8 hexadecimal digits.

As a side note #50C6C6C6 is partially transparent (transparency goes from
#00 for fully transparent to #FF for fully opaque).
 
Patrice said:
Hello,

I gave this a try and it seems that #ABCD is taken as #AABBCCDD. So IMO
your best bet is to always use 6 or 8 hexadecimal digits.
Is 6 assumed to have a 2 digits before it (FF) so it is not transparent?
As a side note #50C6C6C6 is partially transparent (transparency goes from
#00 for fully transparent to #FF for fully opaque).

So the last 6 characters are the color and the 1st 2 (if there are 8
characters) are for transparency?

Thanks,

Tom
 
Is 6 assumed to have a 2 digits before it (FF) so it is not transparent?

Yes.
So the last 6 characters are the color and the 1st 2 (if there are 8
characters) are for transparency?

Correct.

I'm not that fluent with WPF. My approach was just to set the color value in
the XAML file and have some code to display the actual value...
 
Patrice said:
Correct.

I'm not that fluent with WPF. My approach was just to set the color value
in the XAML file and have some code to display the actual value...
You can use 3, 4, 6 or 8.. But only 4 or 8 would be transparent. 3 works
because it can double to 6. 1,2, 5 or 7 are invalid I assume because you
can't make 6 or 8 from 5 or 7 and 1 and 2 don't have enough information.
They do generate an error. Although I would have thought 2 would work, BB
could be BBBBBB.

Thanks,

Tom
 
Back
Top