Re: ability to use background-color in any background layer

On Dec 9, 2014 9:30 AM, "Marat Tanalin" <mtanalin@yandex.ru> wrote:
>
> 09.12.2014, 00:32, "Tab Atkins Jr." <jackalmage@gmail.com>:
> > On Thu, Dec 4, 2014 at 12:29 AM, Anton Tsyganenko
> > <anton-tsyganenko@yandex.ru> wrote:
> >>  Please add an ability to use background-color in any background
layer, like
> >>  this:
> >>
> >>  background: rgba(0, 0, 0, 0.5), url("background.png")
> >>
> >>  It can be useful to darken or lighten a background.
> >
> > Once browsers support the image() function
> > <http://dev.w3.org/csswg/css-images-3/#color-images> you'll be able to
> > generate solid-color images easily, which has the same effect.
>
> So why use `image()` wrapper for a color if we could use the color itself
even more easily?

Because it's not that easy. ^_^

In particular, putting color on each background layer means that
background-color becomes a list. When we have multiple lists that combine
together, they're done element-wise. But the legacy behavior is that
background-color with a single value matches it up with the *last*
background-image value. You'd have to come up with a brand new behavior
where the background-color list is matched against the *end* of the
background-image list, which is confusing and novel.

Sticking with a single background-color and using images for colors on
other layers avoid these issues.

~TJ

Received on Tuesday, 9 December 2014 22:30:57 UTC