Re: [csswg-drafts] [css-values] [css-fonts-4] Native map() function in CSS

@keithjgrant Yes, I can't see why you would want to tie color to the 
viewport width either. Maybe once just for fun :) 

If there is a good way to specify something other than the viewport 
width, that would be great. However I'm not sure that can be easily 
done. Not without another function or feature that resolves the "where
 are we between the bounds of x and y", and I guess it should do this 
regardless of whether x and y are: 400px and 800px, red and blue, or 1
 and 25. I don't know how this might work or if it is a good idea, but
 I'm happy to explore it.

There would be a correct mathematical term for this but I'm not sure 
what it is. I'll call it scale and maybe I can update the example 
later: `scale(<value>, <domain-min>, <domain-max>)`. Returns 0-1.

To use your example:
```
--value = scale(green, red, blue);
color: map(red, blue, var(--value), ease-in);
```
or the `font-size` + `vw` example:
```
--value = scale(100vw, 600px, 800px);
font-size: map(1rem, 2rem, var(--value), ease-in);
```
I'm not sure this is necessarily better than assuming the `map()` is 
related to the viewport. In the majority of cases I think it will be, 
but I'm open to ideas like this.


-- 
GitHub Notification of comment by MadeByMike
Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/581#issuecomment-252669028 
using your GitHub account

Received on Monday, 10 October 2016 16:17:55 UTC