Live data from Hacker News

The Code Side Of Color

coding.smashingmagazine.com

21–30 of 40 posts

Re: The Code Side Of Color

#22

As someone who is colorblind, a lot of my design is based on the logic behind colors rather than looks. Of course, I always let an actual designer approve, tinker with, or redo my work. There are a lot of inaccuracies in this piece but I like the gist of it.

I'm color-sighted but my son is color blind. I find that the easiest way to remember what colors differentiate well is to remember the orange/blue colors that Valve chose for Portal specifically because they have the greatest visual distinction for the greatest number of people. It's also an easy shorthand, because many developers/designers know the game, so you can just say "you know, Portal colors"

That's a great fact! I'm going to remember that.

Re: The Code Side Of Color

#23

Earlier quoted context omitted.

Every base is base 10. ;).

I understand you meant that in jest but base 1 is possible, albeit very cumbersome: 1 = 1 2 = 11 3 = 111 4 = 1111 ...etc.

Really? How do I write zero in your system? (as in the number of apples I have if I have none at all)

If octal uses the digits 0-7, and binary uses the digits 0-1, then shouldn't base one use only the digit 0?

Re: The Code Side Of Color

#24

Earlier quoted context omitted.

I understand you meant that in jest but base 1 is possible, albeit very cumbersome: 1 = 1 2 = 11 3 = 111 4 = 1111 ...etc.

Really? How do I write zero in your system? (as in the number of apples I have if I have none at all) If octal uses the digits 0-7, and binary uses the digits 0-1, then shouldn't base one use only the digit 0?

0 = 1

1 = 11

2 = 111

3 = 1111, etc. {1,2,3...} and {0,1,2...} are isomorphic.

Re: The Code Side Of Color

#25

Earlier quoted context omitted.

Really? How do I write zero in your system? (as in the number of apples I have if I have none at all) If octal uses the digits 0-7, and binary uses the digits 0-1, then shouldn't base one use only the digit 0?

0 = 1 1 = 11 2 = 111 3 = 1111, etc. {1,2,3...} and {0,1,2...} are isomorphic.

But surely that's not the way it works in any other base. In any other base there is a digit '0' such that:

0 = 00 = 000 = 0000 = the number of apples I have if I don't have any.

Re: The Code Side Of Color

#26

Earlier quoted context omitted.

0 = 1 1 = 11 2 = 111 3 = 1111, etc. {1,2,3...} and {0,1,2...} are isomorphic.

But surely that's not the way it works in any other base. In any other base there is a digit '0' such that: 0 = 00 = 000 = 0000 = the number of apples I have if I don't have any.

To dig in a little further, when we say base N, we mean that we are expressing an integer as a sum of the values N^i (for i being every nonnegative integer), each multiplied by a weight that is an integer between 0 and N-1 inclusive.

Why do we do this? Because every integer has exactly one unique representation in this system. We could have picked any values we wanted for the places (rather than N^i) but unless we pick carefully, either some numbers aren't representable, or some numbers have multiple representations.

Base one has a problem right from the start, which is that 1^i = 1 for any value of i - when all places have the same place value, numbers aren't going to have a unique representation. The other problem is that the only number you can write in base one is zero, because the only possible weight (the only integer between 0 and N-1) is 0.

When you write 1111 = 4 you are sneakily using the length of the number on the page to encode the value. The length of the number on the page isn't supposed to matter. In base 10, 17 = 017 = 0017 = 00017.

Re: The Code Side Of Color

#27

Earlier quoted context omitted.

Every base is base 10. ;).

I understand you meant that in jest but base 1 is possible, albeit very cumbersome: 1 = 1 2 = 11 3 = 111 4 = 1111 ...etc.

Sorry for the nitpick, but that's not really "base 1".

It is "unary", which is completely different encoding than the "positional notations" such as decimal, octal, binary, etc. The positional notation doesn't work with base 1, as in that notation there would be only 0, and 0, 00, 000, etc., which all mean the same number: zero.

Re: The Code Side Of Color

#28
post #20

Trying to work with color in RGB triplets is like trying to assemble furniture with a plastic fork. Any discussion of color for programmers needs to be in terms of HSL, with a discussion of Lab for completeness and RGB for dealing with legacy systems.

Maybe I'm getting old, though I'm not even 30 yet, but I've never grasped HSL like I have RGB and RGBA. I come from a background of toying with OpenGL and game programming, so it became habitual as that was the required structure ~10 years ago.

With openGL, DirectX, and other real-time rendering I believe sRGB or linear gamma are preferred because there are library and possibly hardware primitives that can be taken advantage of. Outside of that I feel we should be notating color in terms of the L* a* b* colors

Re: The Code Side Of Color

#29

Earlier quoted context omitted.

But surely that's not the way it works in any other base. In any other base there is a digit '0' such that: 0 = 00 = 000 = 0000 = the number of apples I have if I don't have any.

To dig in a little further, when we say base N, we mean that we are expressing an integer as a sum of the values N^i (for i being every nonnegative integer), each multiplied by a weight that is an integer between 0 and N-1 inclusive. Why do we do this? Because every integer has exactly one unique representation in this system. We could have picked any values we wanted for the places (rather than N^i) but unless we pi…

"When you write 1111 = 4 you are sneakily using the length of the number on the page to encode the value. The length of the number on the page isn't supposed to matter. In base 10, 17 = 017 = 0017 = 00017."

I couldn't find a rigorous definition of a base system offhand. If you require that number N prepended with additive identity I, so IN = N, I agree with you. But every number in the system I described certainly has a unique representation. Also, this is incorrect: "The other problem is that the only number you can write in base one is zero, because the only possible weight (the only integer between 0 and N-1) is 0." Try taking a look at: http://en.wikipedia.org/wiki/Peano_arithmetic

Re: The Code Side Of Color

#30
post #2

Bleh, it seems they forgot to proof this or have it read by someone who ... I don't know, maybe knows a bit more about how it really works. When computers name a color, they use a so-called hexidecimal code that most humans gloss over: 24-bit colors. That is, 16,777,216 unique combinations of exactly seven characters made from ten numerals and six letters — preceded by a hash mark. I mean, "hexidecimal" is hopefully…

Yeah, this bugs me in all kinds of ways (not least because I once wrote a library for converting between the common CSS color specifiers, and had to document this stuff, so there's a lot of "I can do this better and I'm just a guy who writes code").
Post reply on HN