-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spec -webkit-text-fill-color #38
Comments
Messing with http://codepen.io/miketaylr/pen/eJbawd, it seems this might do the same thing as |
Dusting off my 2010 brain here. http://trentwalton.com/2010/03/24/css3-background-clip-text/ |
Ah, cool. Thanks @davatron5000! I was wondering if we could get away with speccing |
If it helps, it appears Edge does the alias thing for |
Cool, good to know. |
Some tests: http://codepen.io/miketaylr/pen/RrvgMO Seems like this plan will mostly work for UAs that don't already support
|
OK, so the cascade bit complicates the simple alias solution to this. Looking at the code on stripe.com, this example would work, but only by accident. If the devs had put
Crazy idea: spec |
Less crazy idea: let's take a look at usage in the wild. Every blog post I've read on |
Some examples from Bugzilla bugs, which seem OK. Need to look at corpus data.
|
OK, some results. From the following search query: https://github.com/search?l=css&p=40&q=-webkit-text-fill-color%3A&ref=searchresults&type=Code&utf8=%E2%9C%93, I looked at the first 400 of some ~30,000 results. Here's the things that stick out as interesting from the small sample: Instances where 1):
(Also of interest is the Opera workaround, from when Presto added basic support for sel {
font-size: 2.8em;
font-family: "brevia",sans-serif;
text-shadow: 0 1px 2px rgba(30, 30, 30, 0.3);
background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#fafafa));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
text-align: center;
font-weight: 400;
color: #FFF;
} sel {
background-color: #333;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-size: 16px;
font-family: 'Brush Script MT', cursive;
text-align: center;
font-family: helvetica, arial, sans-serif;
color: #4e5665;
} .Intro-fancy {
background-image: linear-gradient(92deg,#f35626,#feab3a);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
animation: hue 60s infinite linear;
color: #f35626;
} Instances where sel {
-webkit-text-fill-color: black !important;
color: black !important;
} .stroked-blue {
-webkit-text-stroke: 1px #1f6fd9;
-webkit-text-fill-color: #1f6fd9;
color: #1f6fd9;
} (without sel {
-webkit-text-fill-color : rgb(211, 211, 211);
color: rgb(211, 211, 211);
-webkit-transition: height 70ms ease;
-moz-transition: height 70ms ease;
-ms-transition: height 70ms ease;
transition: height 70ms ease;
overflow: hidden;
} And finally, one interesting (or weird) result because the developer is using these as aliases already
Based on this quick sample of 400, 1% of the results would be broken by the simple alias approach. That's kind of better than I was expecting. |
So to summarize, there's two possible ways I see to define
1 seems simplest to implement, but has the downside that not everything works. That might be OK if it's indeed fixing 99% of usage that was broken before. @dholbert, as someone who hacks on CSS parsers and layout what do you think? There's a ton to read here, #38 (comment) is probably the most important to get up to speed. |
I think option (2) shouldn't be too hard, and I can see it being necessary for us to trump later So - I think I'm on board with option (2). |
Cool, thanks for the feedback @dholbert! |
Actually, I think this might be specced incorrectly, from a "how it works in Chrome" standpoint. As I've just noted in bug 1247777, it seems to me that this really works like so: See the bug for more details & justification. @miketaylr, does this make sense to you & is it consistent with your testing? (and perhaps the spec needs a tweak?) |
Yep, I think you're right. Thank you! |
…t color. (i.e., this is _not_ an alias to color, but it gets its initial currentcolor value from the color property defined on the same element)
OK, made suggested changes to actually reflect what Blink and WebKit do. |
It seems we need
-webkit-text-fill-color: transparent
so-webkit-background-clip: text
does what is intended. Pretty much every example I see uses 'transparent', though WebKit and Blink allow you to specify any<color>
for trulyuglyartistic effects.Introduced here: https://webkit.org/blog/85/introducing-text-stroke/ (with
-webkit-text-stroke-color
,-webkit-text-stroke-width
, and the shorthand-webkit-text-stroke
)It may make sense to just spec
transparent
for now, so the main use case of #26 can work, but we can crawl some corpus data to better understand usage in the wild.See also: https://www.chromestatus.com/metrics/css/popularity#webkit-text-fill-color -- this is twice as popular as the other 3 non-standard text props.
The text was updated successfully, but these errors were encountered: