Sheehan Alam
Sheehan Alam

Reputation: 60909

What is 0x30 when defining a color?

I saw an example online:

private int[] colors = new int[] { 0x30F8F8F8, 0x30EAEAEA };

I am not sure what the first chars represent, but the last 6 look like hex numbers. Is this correct?

Upvotes: 2

Views: 1041

Answers (3)

corsiKa
corsiKa

Reputation: 82589

Depending on the format, it looks like those colors are in RGBA (or some other re-ording of them.)

Essentially,

0x30 = Alpha component
0xF8 = Red component
0xF8 = Green component
0xF8 = Blue component

If you know which one is alpha, you can replace it with 00, or if it at the beginning, remove it

0xF8F8F8
0x00F8F8F8

Upvotes: 6

Dana the Sane
Dana the Sane

Reputation: 15208

The left-most 2 numbers represent the alpha channel (transparency) in formats that support 32bit colour. The two colours in your array are shades of grey with the same transparency level.

Also, 30 is a hex number.

Upvotes: 0

Femaref
Femaref

Reputation: 61467

30 is a hex number as well. It means 3*16^1 + 0*16^0 = 48 in decimal. I might be the alpha channel, but you can only be sure after you read the documentation for the method using that array.

Upvotes: 0

Related Questions