delete
delete

Reputation:

What's this numeric notation called?

add(new CustomLabelField
("Please enter your credentials:", Color.WHITE, 0x999966, 0));

What is that 0x999966?

I want to place this color there so how can I convert it? I just need an online tool that will convert it for me but I don't even know what it's called! :D

link for more info

Thanks!

Edit: OK, so this is called a hexadecimal number, but I still don't know how to convert something like "#716eb3" to the notation accepted by the CustomLabelField constructor. Any help?

Upvotes: 0

Views: 891

Answers (6)

Dave M
Dave M

Reputation: 1322

If it's C#, the format expected by the CustomLabelField constructor is most likely System.Drawing.Color that uses the ARGB format.

“The color of each pixel is represented as a 32-bit number: 8 bits each for alpha, red, green, and blue (ARGB). The alpha component specifies the transparency of the color: 0 is fully transparent, and 255 is fully opaque. Likewise, an A value of 255 represents an opaque color. An A value from 1 through 254 represents a semitransparent color. The color becomes more opaque as A approaches 255.”

Converting the ARGB format into a System.Drawing.Color can be done as follows:

Color myColor = ColorTranslator.FromHtml("#FF999966");

Upvotes: 0

dheerosaur
dheerosaur

Reputation: 15172

  1. In many programming languages, numbers prefixed with 0 are octal and with 0x are hexadecimal.

  2. Search for Hexadecimal to Decimal or Hexadecimal to RGB converters.

Upvotes: 0

Bruno
Bruno

Reputation: 122729

It looks like it might be in Java.

First, take the substring to remove the # prefix, then use Integer.parseInt("9999966", 16): that's parseInt with the radix for the base (see Integer documentation). Something along these lines:

String colour = "#716eb3";
colour = colour.substring(1,colour.length()-1);
add(new CustomLabelField ("Please enter your credentials:",
     Color.WHITE, Integer.parseInt(colour,16), 0));

Upvotes: 0

Darin Dimitrov
Darin Dimitrov

Reputation: 1039170

Looks like a hexadecimal representation of a RGB. For example with #716eb3:

add(new CustomLabelField
("Please enter your credentials:", Color.WHITE, 0x716eb3, 0));

Upvotes: 0

codaddict
codaddict

Reputation: 455302

Thats a number in base 16 or hexadecimal number.

Upvotes: 0

Gian
Gian

Reputation: 13955

Hexadecimal, as in, base 16. If 0x999966 is indicating a color, then it's usually encoded such that each two hex digits encode a color (as RGB), so it's 0xRRGGBB.

Upvotes: 2

Related Questions