Hex Color Codes - Hex 6 <=> Hex 3

L

lucanos

Hi All,

Probably a simple question, but rest assured I have looked around for
answers before trying to use this forum as my last resort.
(No-one likes the RTFM directive...)

I'm trying to translate the HTML Color Codes between the Hex 6 & Hex 3
standards.
Does anyone know of any online translators to do this?
Or should I simply use basic rounding to change Hex6 to Hex3 (ie
#A1B7C9 becomes #ABD).

I'm just trying to tweak a CSS'd set of pages, and the previous
developer had a penchant for the shorter color codes.

Thanks
Luke
 
M

Mark Parnell

Previously in alt.html said:
Or should I simply use basic rounding to change Hex6 to Hex3 (ie
#A1B7C9 becomes #ABD).

Any 3-digit value can be expressed as a 6-digit value, e.g. #ABD is
equivalent to #AABBDD.

Most 6-digit values cannot be expressed in 3-digits though. For #A1B7C9,
#ABD is probably the closest, but the 2 colours are significantly
different. http://clarkecomputers.com.au/usenet/hex.html
I'm just trying to tweak a CSS'd set of pages, and the previous
developer had a penchant for the shorter color codes.

As above, converting from 3 to 6 is easy - just duplicate each of the 3
digits.
 
L

lucanos

Thanks Mark,

I thought that was the case, but always better to have my assumptions
approved by those who know best.

Thanks again,
Luke
 
D

dorayme

From: (e-mail address removed)
Probably a simple question, but rest assured I have looked around for
answers before trying to use this forum as my last resort.
(No-one likes the RTFM directive...)

I'm trying to translate the HTML Color Codes between the Hex 6 & Hex 3
standards.
Does anyone know of any online translators to do this?
Or should I simply use basic rounding to change Hex6 to Hex3 (ie
#A1B7C9 becomes #ABD).

I'm just trying to tweak a CSS'd set of pages, and the previous
developer had a penchant for the shorter color codes.


Don't use 3 for the mere sake of shorter colour css specification.
#XXYYZZ is the format of a class of so many colours. This format has a
shorthand of #XYZ. Within this class, the implication goes the other
way too. So one can expand #XYZ to #XXYYZZ.

If you want a larger class of colours, stick to 6. There is nothing
then to gain from 3ing colours that happen to be like #XXYYZZ and lots
to lose, namely a changing of actual colour when 3ing a colour like
#UVWXYZ by some rather arbitrary "rounding". There is unlikely to be a
logical way of doing this to preserve the approx colour without
reference to the colour itself and matching a "close enough" colour
between two sets of colour (in which one is a subset of the other).

dorayme
 
M

mbstevens

dorayme said:
Don't use 3 for the mere sake of shorter colour css specification.
#XXYYZZ is the format of a class of so many colours. This format has a
shorthand of #XYZ. Within this class, the implication goes the other
way too. So one can expand #XYZ to #XXYYZZ.

If you want a larger class of colours, stick to 6. There is nothing
then to gain from 3ing colours that happen to be like #XXYYZZ and lots
to lose, namely a changing of actual colour when 3ing a colour like
#UVWXYZ by some rather arbitrary "rounding". There is unlikely to be a
logical way of doing this to preserve the approx colour without
reference to the colour itself and matching a "close enough" colour
between two sets of colour (in which one is a subset of the other).

This would _only_ matter in photo retouching, digital imaging,
and the like. Designing pages with backgrounds and foregrounds
from three hex integers provides more than enough colors. I
find it also makes it easier to tweak the colors -- to find
combinations I like without resorting to a color chart.
 
D

dorayme

From: mbstevens said:
This would _only_ matter in photo retouching, digital imaging,
and the like. Designing pages with backgrounds and foregrounds
from three hex integers provides more than enough colors. I
find it also makes it easier to tweak the colors -- to find
combinations I like without resorting to a color chart.
--


I, too, tend to only use the 3 hex lot. But this
may not suit everyone. I have fancied that I
can't *always* get what I want in 3 and so use 6
now and then. But this may be a simple conceit.
Every person needs some to have the pride to go
on.

dorayme
 
K

Kevin Scholl

Hi All,

Probably a simple question, but rest assured I have looked around for
answers before trying to use this forum as my last resort.
(No-one likes the RTFM directive...)

I'm trying to translate the HTML Color Codes between the Hex 6 & Hex 3
standards.
Does anyone know of any online translators to do this?
Or should I simply use basic rounding to change Hex6 to Hex3 (ie
#A1B7C9 becomes #ABD).

Actually, #9BC would be closer.
I'm just trying to tweak a CSS'd set of pages, and the previous
developer had a penchant for the shorter color codes.

Unless there is a direct translation (e.g., #336699 = #369), I
personally wouldn't muck with the color codes. Those few extra bytes of
info aren't likely going to affect anything.

--

*** Remove the DELETE from my address to reply ***

======================================================
Kevin Scholl http://www.ksscholl.com/
(e-mail address removed)
 
N

Neredbojias

With neither quill nor qualm, dorayme quothed:
I, too, tend to only use the 3 hex lot. But this
may not suit everyone. I have fancied that I
can't *always* get what I want in 3 and so use 6
now and then. But this may be a simple conceit.
Every person needs some to have the pride to go
on.

Every person needs some for simple contentment.
 
M

mbstevens

Neredbojias said:
With neither quill nor qualm, dorayme quothed:




Every person needs some for simple contentment.

Hoare's Law:
"Inside every large program is a small program
struggling to get out."
C.A.R. Hoare

(I think it applies to CSS markup, too.
Go baroque and you'll go broke.)
 
N

Neredbojias

With neither quill nor qualm, Steve Pugh quothed:
ABD = AABBDD
9BC = 99BBCC

A1 = 161, AA = 170, 99 = 153
hence A1 is closer to 99 than AA

C9 = 201, DD = 221, CC = 204
hence C9 is closer to CC than DD

So #9BC would be the closest Hex3 version of #A1B7C9

Steve

Duh, yeah, I do that all the time. #abd is *not* #a0b0d0, it's #aabbdd.
I will write that in a complete sentence 500 times on notebook paper as
soon as I disconnect.
 

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,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top