Saw this great little question on the Macromedia instructor's mailing list, and it had me stumped. What's with the odd "0x" in front of hex colors instead of the standard # sign? For example, 0×000000 vs. #000000. Why is it "0x" rather than something else?
Ken Fricklas had the answer, "Just zero, then x is short for 'hexadecimal'. In the old days we also had binary, decimal, and octal to deal with. For binary, you didn't put anything, for octal you'd start numbers with 0, for hexadecimal 0x and for decimal nothing. BTW, 0x indicated that the hex digits would be lowercase, e.g. 0xabcdef and 0X would indicate uppercase (0XABCDEF)".
Something oddly satisfying about knowing the history of these arcane minutiae.
Posted by modius at 06:31 PM | Permalink
Trackback: http://blog.daemon.com.au/cgi-bin/dmblog/mt-tb.cgi/150


One thing that baffles new users as well is when you call .getRGB() on something that has had a color applied, it returns the integer equivalent to the hex value.
People without a background in number theory get caught up on "I set it to 0xFFCC00 but its RGB value isn't even close to that!"
:-)
Posted by: darron on August 2, 2003 10:42 PM