- From: Lea Verou <leaverou@gmail.com>
- Date: Mon, 21 Nov 2011 12:24:26 -0800
- To: "Tab Atkins Jr." <jackalmage@gmail.com>
- CC: Kevin Bortis <kevin@bortis.ch>, W3C Style <www-style@w3.org>
On 21/11/11 09:53, Tab Atkins Jr. wrote: > On Mon, Nov 21, 2011 at 6:06 AM, Kevin Bortis<kevin@bortis.ch> wrote: > >>>> em { color: aliceblue 1 } /* aliceblue = #F0F8FF, alpha 1 */ >>> That’s unnecessary and not backwards compatible. >> Most browsers are ignoring the "1". The inclusion of rgb() and rgba() >> in the current CSS spec is a mistake in my eyes. First you define a >> color and then tell the browser to add transparency to it. Defining >> two function for every possible color definition is not a very good >> solution ( rgb(), rgba(), hsl(), hsla()....). > Browsers don't "ignore the 1" - they drop the declaration entirely, > because it's currently a syntax error. > > Using a second function ending in an "a" is established practice and > seems okay to me. It doesn't seem to be a a huge win to just pull the > alpha out of the function and put it next to the color instead, and > there are compat problems, as I explain below. > >> Why should it be impossible to add the possibility for such color >> definitions as: { color: aliceblue 0.5 } in the level 4 color module? > It's not impossible, but I already know of one place where it's > ambiguous -<color-stop> definitions in gradients are defined as > "<color> && [<length> |<percentage>]?". If<color> is changed to be > an opaque color + a number, then the color-stop "red 0" is ambiguous - > is it fully-transparent red with an auto location, or is it > fully-opaque red located at 0? If<color> also allows percentages, > then any position specified in percentages is ambiguous. > > In general, it's best for core value types to be single tokens for this reason. > > ~TJ > This could be rectified by using a more human-readable syntax like for example "80% of aliceblue". Color stops would then become unambiguous, although still hard to read, like: linear-gradient(50% of black 10%, 90% of white 80%) However I'd argue that this is also hard to read, if not harder: linear-gradient(rgba(0,0,0,.5) 10%, rgba(255,255,255,.9) 80%) As an author, I'd welcome such a change. I can't even begin to count how many times I had to convert a hex color or a keyword to RGB/HSL to be able to apply transparency to it. Not all color notations are functional to get a second function ending in "a". Obviously, such a change would also instantly solve all previous debates around #RRGGBBAA and #RGBA (I don't remember if consensus was reached on that one). -- Lea Verou (http://lea.verou.me | @LeaVerou)
Received on Monday, 21 November 2011 20:24:59 UTC