W3C home > Mailing lists > Public > www-style@w3.org > March 2011

RE: [css3-background] Default shadow color

From: Sylvain Galineau <sylvaing@microsoft.com>
Date: Fri, 4 Mar 2011 00:00:50 +0000
To: fantasai <fantasai.lists@inkedblade.net>
CC: "www-style@w3.org" <www-style@w3.org>
Message-ID: <045A765940533D4CA4933A4A7E32597E2AB88215@TK5EX14MBXC113.redmond.corp.microsoft.com>


[fantasai:] 
> On 03/03/2011 02:56 PM, Sylvain Galineau wrote:
> > The color element of a box shadow is optional [1]:
> >
> > 	"...omitted colors are a UA-chosen color."
> >
> > Is there are reason not to make the shadow color currentColor as
> > opposed to 'a UA-chosen color' ? This would also apply to text-shadow
> > and make this clearly testable, at least.
> >
> > [1] http://dev.w3.org/csswg/css3-background/#the-box-shadow
> 
> http://lists.w3.org/Archives/Public/www-style/2010Dec/0426.html
> 
> currentColor is not a good color to use for shadows. It's 99.999% of the
> time the wrong color. :) And I'm pretty sure there are lots of pages out
> there depending on it being a shade of gray rather than currentColor.

I don't see how we assert it's wrong 99.999% of the time. That is entirely up 
to the author, depends on the presence/color of a border, background color of 
the content etc. 

Be that as it may, how can anyone *depend* on it being a shade of gray if 
it's undefined and UA-chosen ? If all browsers do use the same shade of gray  
then we should specify that. 

Last, I see the shadow matching currentColor in Opera 11, Firefox 4 and IE9.
(Chrome seems to have a problem with a missing color). So if someone does 
depend on getting 'a shade of gray' it seems they're broken. 

<!doctype html>
<style>
 body {
   color:yellow;
 }
.test {
   width:300px; height:200px;
   margin:10px;
   border:1px dotted black;
   box-shadow: 5px 5px 0px;
}
#test1 {   
   color:black;
}
#test2 {   
   color:red;
}
#test3 {   
   color:rgba(0,200,0,0.7);
}
#test4 {   
   color:curentColor;
}
</style>

<div class="test" id="test1">Black</div>
<div class="test" id="test2">Red</div>
<div class="test" id="test3">Green with .7 alpha</div>
<div class="test" id="test4">currentColor (yellow)</div>
Received on Friday, 4 March 2011 00:01:25 GMT

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