W3C home > Mailing lists > Public > www-style@w3.org > August 2012

Re: [media-queries] and Ambient Light Sensor API

From: Florian Rivoal <florian@rivoal.net>
Date: Wed, 22 Aug 2012 23:07:23 +0200
To: www-style@w3.org
Message-ID: <op.wjgnml0bf5de51@localhost.localdomain>
On Tue, 21 Aug 2012 20:31:27 +0200, Tab Atkins Jr. <jackalmage@gmail.com>  
wrote:

> On Tue, Aug 21, 2012 at 7:04 AM, Daniel Glazman
> <daniel.glazman@disruptive-innovations.com> wrote:
>> Hello Doug, public-device-apis@w3.org and www-style@w3.org
>>
>> Looking at the WD of Ambient Light Sensor API [1] on one hand and at
>> the IDPF Alternate Style Tags spec for EPUB3 by Fantasai (in particular
>> the 'day' and 'night' values) [2] on the other, I really wonder if that
>> API should not have its Media Queries [3] counterpart...
>>
>> For instance:
>>
>> feature  'ambient-light-sensor'
>> Value: <integer>
>> Applies to: visual media types
>> Accepts min/max prefixes: no
>>
>>   Value will be 1 if an ambient light sensor is available on the device
>>   and 0 if not.
>>
>> feature 'ambient-light-level'
>> Value: <number>
>> Applies to: visual media types
>> Accepts min/max prefixes: YES
>>
>>   This media feature describes the ambient light level in lux. The
>>   specified <number> cannot be negative.
>
> I'd rather define a 'lux' unit if we're doing this.  Also, I agree
> with others that having some keyword values is useful.  I don't know
> how many levels would actually be useful, though.  ePub apparently
> does "night" and "day".  We can either use those, or define a
> different pair, like 'dim' and 'bright'.

Agreed with the lux unit if we take this approach. However,
there is one thing that worries me. Most devices that have
a light sensor will themselves adjust the screen brightness
in response to changes in ambient luminosity. The level of
contrast you want to pick for your web page should depend
no only on the ambient light level, but also on the brightness
of the screen. If the screen is already very dim, reducing
the contrast could make things unreadable.

Also, most web authors would probably have no idea
a which level of luminosity they should switch their styling.

Maybe I am overthinking this, but although I like the idea
of a media query to respond to changing light levels,
I am not sure that exposing a raw value in lux is the
optimal approach.

I haven't thought about it too much yet, but maybe
letting the UA decide when to dim things, and exposing
the result of that decision through an MQ would work better.

light-adjustment: none | low-contrast

Or something in that vein

> I'd prefer we not introduce a half-dozen or more keywords without
> evidence that they're useful.  I think most of the time you'll only
> want to reduce the brightness of your page in dim light, but not do a
> lot of gradations.

The same reason that makes you dislike keywords is what leads me to
wonder if numbers are any better.

  - Florian
Received on Thursday, 23 August 2012 09:11:51 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:58 GMT