Hacker News new | ask | show | jobs
by gkya 3170 days ago
Colour codes are hexadecimal numbers, 000000 is basically zero, and is for black. FFFFFF is 16777215 and is white. The more the numerical value of the colour the lighter it is, the lower the darker (well, not exactly, but kind of).
2 comments

Right, but to be pedantic, the OP's original statement was ambiguous.

"more thant[sic] #333 on white"... You could interpret this many ways.

A) You could interpret "#333 on white" to refer to the contrast ratio of "#333/#fff", which according to this calculator [1] is 12.6. In this case "more" is referring to a higher contrast ratio. "#000 on #fff" would fit - even though "#000" is less than "#333" - because the contrast ratio of the two colors is 21.

B) You could interpret the statement as "(more than #333) on #fff", e.g. increasing the numerical value of "#333". Something like "#444 on #fff" - which actually has a lower contrast ratio of 9.7 - fits, because "#444" is more than "#333".

This is dumb, I'm just pointing out that it can be important to be precise with your language.

1: http://leaverou.github.io/contrast-ratio/#%23333-on-%23fff

I'm the OP, and yes, I should've worded that out better.
Expanding on this a little more, it's actually broken up into hexadecimal pairings (or 8-bit numbers).

00 00 00 = R(0) G(0) B(0) for Red, Green Blue

FF FF FF = R(255) G(255) G(255)

That makes 16,777,216 possible combinations (256^3).

For pure red, that's FF0000; green, #00FF00; blue, #0000FF. Mixing those is how you get intermediary colors: red + green = yellow; red + blue = magenta; green + blue = cyan.

When the colors are referenced as single-digit hex numbers, that value is applied for the pairing. This would make #F00 (red) actually be applied as #FF0000.