News for hackers. Stuff that matters.
Re:All of the available CSS color names by simonsarris on Saturday July 21, 2012 @08:38PM (#4276120)
Well I found at least one good use for them.

I'm writing a book and I use nothing but the CSS color names in all of the examples. I think it makes the code snippets easier to parse and visualize as a human when you're reading through the text. For example:

  // Create a vertical gradient going from the top of the canvas to the bottom
  var gradient = ctx.createLinearGradient(0, 0, 0, can.height);
  gradient.addColorStop(0, 'Black');
  gradient.addColorStop(0.15, 'Black');
  gradient.addColorStop(0.2, 'DarkSeaGreen');
  gradient.addColorStop(0.4, 'DarkSeaGreen');
  gradient.addColorStop(0.7, 'Goldenrod');
  gradient.addColorStop(0.8, 'DarkOrange');
  gradient.addColorStop(1, 'GhostWhite');
Then, as I spend a paragraph talking about color stops, I can refer to real color names and not #00000, #8FBC8F, etc. I think the humans reading the text will appreciate it, but we'll see!
Re:All of the available CSS color names by jacobolus on Saturday July 21, 2012 @08:51PM (#4276146)
If you’re referring to these by strings, wouldn’t you be just as well off spending a few lines of code somewhere above setting up some variables for hex colors? This seems like a pretty trivial kind of advantage.
Re:All of the available CSS color names by primatology on Saturday July 21, 2012 @11:20PM (#4276348)
What if he were writing straight CSS, though? No possibility for variables there. (Not yet, at least.)