Re: [mediaqueries] Making the 'color' query static, like CSSOM colorDepth?

On Thu, Aug 1, 2013 at 2:00 PM, Florian Rivoal <florian@rivoal.net> wrote:
> On Thu, 01 Aug 2013 22:35:40 +0200, Tab Atkins Jr. <jackalmage@gmail.com>
> wrote:
>> It turns out that in practice, pixelDepth/colorDepth is worthless in
>> the CSSOM, so we've frozen it as just returning a static 24.
>>
>> The 'color' media query, though, is basically the same thing.
>> Presumably we should apply the same decision, and freeze it as
>> returning either 0 or 8 (depending on whether it's monochrome, like
>> some e-readers, or color).
>>
>> Same thing with 'monochrome', for that matter - freeze it as 0 or 8.
>>
>> This won't effect these MQ's use without values - a simple (color) or
>> (monochrome) MQ will still be true/false as appropriate. This'll just
>> remove the polite fiction that browsers actually return something
>> useful with these depth numbers.
>
> While I don't think I see any major problem doing this, I am also not
> sure what we gain from it.

Code simplification and predictability.  Blink, for instance,
currently *sometimes* takes the color depth (when it can be trivially
known), and then just divides by 3 and truncates to integer.  I'm not
sure how, when, or why we sometimes know that, though - I also know
that sometimes the hardware only supports 6 bits, and we don't easily
know that at the engine level and don't care about it.

Further, while it's theoretically possible that someone could want to
style differently based on the color depth, in all honesty that won't
happen.  Even if you were on a mere 216 colors (3.7 bits per
channel?), a webpage designed with the assumption of 8-bit color would
display fine, albeit a bit ugly (but all webpages are a bit ugly on
216 colors, so whatever).  If you had 10 bits or more per channel, it
wouldn't significantly affect anything; you'd just get prettier
gradients.

I think you have to go all the way down to monochrome before the real
possibility of someone tweaking their design becomes even slightly
realistic (so you can avoid using colors with similar lightness values
which contrast fine in color but are identical in monochrome), so I'm
fine with preserving the two media queries as binary tests.  I'd
switch them both to just be 0/1 like a normal binary MQ, except that
if there's *any* code on the web depending on the actual value, it'll
be depending on a value of 8, and so it's painless to just freeze it
at 8.

~TJ

Received on Thursday, 1 August 2013 21:50:59 UTC