Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Right. A 12 bit palette would be 4096 colors.


In this context, 12bit refers to the combined bit count of RGB (each 4bit)


In the context of the original post, or in the context of talking about color depth in general?

In the context of the original post, it seems like Kate is just talking about 12 total colors, it's not 12 bit in any logical sense.

In the context of color depth sure, 12-bit color[0] would be 4 bits per channel.

[0]: https://en.wikipedia.org/wiki/Color_depth#12-bit_color


Did you read the article?

> The palette uses a 12-bit colour depth, so each colour requires only four characters when specified as a hexadecimal colour code in a CSS or SVG file


But hold on 4 characters...

A single ASCII character is minimum 8 bits so 4x8 is 32 bits... assuming the hash is ignored that's still 24 bits.

What have I missed?


A HTML color hex code does not use all available bits in a byte but has a strict format. It's of the form #abc, where # is fixed and abc are hex digits (0-9 A-F), one for R, G, and B. Thus, each channel has 4 bits of precision.

PS: ASCII is a 7-bit encoding. "8 bits minimum" sounds like you are thinking in UTF-8.


Ah thanks, and yes I was.


The author doesn’t understand/communicate-well what a n-bit color palette means, which then confused the rest of us. It refers to the complete size of the palette, in 2^n of course.

She created a 12-entry indexed palette, from the 12-bit (4096) possibilities of short css-hex codes, one nibble per char. (Also single css-hex codes double, so results are brighter than expectations.)

Tldr: This is a 12-entry indexed palette, not a 12-bit one. Neither of which we are constrained to.


Ah right. I did read it, but I didn't comprehend it properly, because she also happened to also only choose 12 colors for the palette.

I see now, she's saying that it's 12 bit, because instead of using a 6 digit hex code, she is using 3 digit hex codes, at four bits per hex value, it's 12 bits.


The article is about choosing 12 colors from the 4096-color palette.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: