WPF Transparent Colors

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
 
P

Patrice

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).
 
T

tshad

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
 
P

Patrice

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...
 
T

tshad

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top