4

Possible Duplicate:
3 digit Hex color code
Using 3-digit color codes rather than 6-digit color codes in CSS

I have a color that has the following RGB values:

255-223-145

I see that lots of pages have the colors with just three digits, for example:

color: #999;

I wonder why, and how would I convert these rgb values to a three digit color.

Thanks

Community
  • 1
  • 1
Hommer Smith
  • 26,772
  • 56
  • 167
  • 296
  • RGB to Hex - http://www.javascripter.net/faq/rgbtohex.htm – Gurpreet Singh Nov 13 '12 at 15:05
  • The calculator that comes standard with Windows can convert between decimal <-> hex. View > Programmer: set it to `Dec` when you want to see/type in decimal numbers, set it to `Hex` when you want to see/type hexadecimal numbers. – cimmanon Nov 13 '12 at 15:10

3 Answers3

7

It isn't a three digit colour, #999 is merely shorthand for #999999 so unless your numbers repeat like #223322 (#232) you can't cut it down.

The question has two bits, to convert hex to rgb, use a tool like this or this online.

Andy
  • 14,427
  • 3
  • 52
  • 76
4

#999 is shorthand for #999999, and #ABC is short for #AABBCC. CSS colors can be shortened if you don't need the full six hex digits.

Your color in hex is #FFDF91. The closest three-digit color would be #FD8 (#FFDD88). Close, though not identical.

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
0

You can write shortly if you have 2 same digits

FF -> F
99 -> 9

So #999 = #999999 and #FFF = #FFFFFF

Cedrun
  • 457
  • 2
  • 8