Re: [css-color] Doubts on how we handle device-cmyk() and similar things

On Thu, Aug 21, 2014 at 2:04 PM, Florian Rivoal <florian@rivoal.net> wrote:
> On Thu, 21 Aug 2014 22:17:28 +0200, Tab Atkins Jr. <jackalmage@gmail.com>
> wrote:
>> Before we introduce color profiles, anything
>> using a color object will assume it's in the sRGB colorspace.  Putting
>> a .profile attribute on it wont' do anything for the old browsers.
>> This is similar to CSS - if you try and pass a colorspace argument to
>> a color function, it'll be invalid.  Just like CSS, if you want to be
>> robust in both worlds, you need to provide an sRGB version as well.
>> (In CSS, you provide it unconditially and first; in JS you
>> feature-test and provide it only if the browser doesn't support
>> profiles).
>>
>> (At least this fails gracefully - being in the wrong colorspace just
>> means your colors will be a bit off, but are still more-or-less
>> correct.)
>
> We could pick a property right now, decide what value of that property means
> sRGB, and throw an exception if you get anything else. Then putting a
> .profile attribute with something else than sRGB in old browsers gets you an
> exception, rather than a wrong color, so that you can deal with it.
>
> I like graceful failing in declarative things, but in JS, I'd rather get
> errors thrown back at me so that I can deal with them.

We don't normally do that sort of forward design, and I don't think
it's necessary to protect ourselves against code trying to set a
non-existent .profile attribute today.

In the future, detecting if profiles are supported is just a simple
feature-test.  I think this is adequate, because what you going to do
if they're not supported?  If you have code to transfer colors across
profiles manually, you're already doing sophisticated things, and
doing a feature-test before activating that is fine (rather than
having you pepper your code with try/catch and do profile application
at point-of-use).  If you don't have anything like that, making the
code fail is probably strictly worse for you, and you'd prefer
slightly worse colors that still work.

~TJ

Received on Tuesday, 7 October 2014 22:07:00 UTC