# Forum > Discussion > Mad Science and Grumpy Technology > Coding HTML Color Codes

## AvatarVecna

Some friends and I have been tooling around with color codes on the forum and we're trying to figure out the logic behind some things. Some things just translate directly into HTML color codes by default (infamously, "c0ffee" makes coffee), while some words are the default name for a color ("gold" makes gold). But we've been putting random words in and seeing what colors come out, and we're trying to figure out the logic behind it, since none of them are really color names. Some letters don't really translate into HTML the way coffee does, and they're definitely not normal color names, and yet they're still returning colors?

As a few examples (with each word being its own color code):

AvatarVecna
Zookeeper
McDonalds
Puppets
Santa
Halloween
Keyboard
Administrator

If anyone can shed light on what's happening here, I'd love to hear it.  :Small Smile:

----------


## Jasdoif

The standard is, shall we say, exciting....To sum up the type of stuff you're talking about**: The browser converts non-hex-digits in the color code to 0, pads the end with 0s make the length a multiple of three if it isn't already, splits them into R/G/B pieces, trims equally shared leading zeroes to a minimum of two characters each, truncates to the leading two characters if necessary, and uses *that* as the RGB value.

*Spoiler: One by One*
Show


AvatarVecnaa0a0a00ec0a _(convert)_a0a0a00ec0a0 _(pad)_a0a0, a00e, c0a0 _(split)_a0, a0, c0 _(truncate to two)_a0a0c0

ZooKeeper0000ee0e0 _(convert)_000, 0ee, 0e0 _(split)_00, ee, e0 _(trim leading zeros)_00eee0

McDonalds0cd00a0d0 _(convert)_0cd, 00a, 0d0 _(split)_cd, 0a, d0 _(trim leading zeros)_cd0ad0

Puppets0000e00 _(convert)_0000e0000 _(pad)_000, 0e0, 000 _(split)_00, e0, 00 _(trim leading zeros)_00e000

Santa0a00a _(convert)_0a00a0 _(pad)_0a, 00, a0 _(split)_0a00a0

Halloween0a0000ee0 _(convert)_0a0, 000, ee0 _(split)_0a, 00, ee _(truncate to two)_0a00ee

Keyboard0e0b0a00  _(convert)_0e0b0a000 _(pad)_0e0, b0a, 000 _(split)_0e, b0, 00 _(truncate to two)_0eb000

Administratorad0000000a000  _(convert)_ad0000000a00000 _(pad)_ad000, 0000a, 00000 _(split)_ad, 00, 00 _(truncate to two)_ad0000

----------


## AvatarVecna

> The standard is, shall we say, exciting....To sum up the type of stuff you're talking about**: The browser converts non-hex-digits in the color code to 0, pads the end with 0s make the length a multiple of three if it isn't already, splits them into R/G/B pieces, trims equally shared leading zeroes to a minimum of two characters each, truncates to the leading two characters if necessary, and uses *that* as the RGB value.
> 
> *Spoiler: One by One*
> Show
> 
> 
> AvatarVecnaa0a0a00ec0a _(convert)_a0a0a00ec0a0 _(pad)_a0a0, a00e, c0a0 _(split)_a0, a0, c0 _(truncate to two)_a0a0c0
> 
> ZooKeeper0000ee0er _(convert)_000, 0ee, 0e0 _(split)_00, ee, e0 _(trim leading zeros)_00eee0
> ...


Okay that's pretty neat!  :Small Smile:

----------


## KillianHawkeye

Huh, that's interesting. TIL

----------

