W3C home > Mailing lists > Public > www-style@w3.org > July 2014

Re: [css-color-4] Renaming gray()

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 23 Jul 2014 11:47:57 -0700
Message-ID: <CAAWBYDCXDBHs3+7F9Rrgm3PJHKHUXByvTmC+qp_+-CqqNT71wQ@mail.gmail.com>
To: Rik Cabanier <cabanier@gmail.com>
Cc: Lea Verou <lea@verou.me>, www-style list <www-style@w3.org>
On Wed, Jul 23, 2014 at 11:14 AM, Rik Cabanier <cabanier@gmail.com> wrote:
> On Wed, Jul 23, 2014 at 11:01 AM, Lea Verou <lea@verou.me> wrote:
>> The gray() functional notation [1] is a great idea for specifying
>> desaturated colors with varying degrees of transparency in a concise and
>> readable way. However, I’m not sure about the naming. Right now, the named
>> color `gray` corresponds to gray(50%). gray(0%) is black and gray(100%) is
>> white.
>>
>> After using this function myself for a while (through emulating it in
>> SASS), I’m starting to think its naming is quite unintuitive. The usual
>> assumption with functions that take a 0-100% parameter is that 100% gives
>> the full “effect” of the function name, in this case, gray. Ask any random
>> person what color they think gray(100%) represents, I doubt they’d guess
>> white. I just tried it with a friend and his response verified what I
>> thought.
>> For example, think of CSS filter functions: sepia(100%) colorizes the
>> image as sepia, values < 100% are a lighter version of the effect. Same with
>> invert(), grayscale() etc.
>>
>> If we want to keep the link to hsl(), white() might be a better name.
>> Although, I’m not sure if white(0%) == black is exactly intuitive, but it
>> seems more intuitive than gray(0%).
>> Or, we might reverse the parameter and have black(100%) == black and
>> black(0%) == white, which is on par with how many real life things work,
>> such as (grayscale) printing.
>> Or maybe someone else has a better idea?
>
> This is probably a remnant from postscript's 'setgray' function.

There's plenty of references, actually, to numbered grays going from
black to white.

> I always found it to be very confusing as well so I support renaming 'gray'
> to 'black'

I'm not opposed to a rename to black(), but I'd like to give some more
thought to this.  There might be even more intuitive ways of
expressing this.

~TJ
Received on Wednesday, 23 July 2014 18:48:45 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:23 UTC