-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Description
I've discovered that when I'm working with colors that the current color functions don't work well enough for me. Doing some research I found a nice little explanation of how to do RGB tints (http://j.mp/U17z3x) but don't have the knowledge to work it out.
As a designer, it would be great to go @color: tint(#ff6600, 20%);
and get the expected result.
Here's a better explanation of what I found and what could work within RGB without needing to first convert to HSL:
Tint is calculated in each color channel. The following formula should work:
t = tint in decimal format
V = original value
N = new value
(t * V) + (1 - t)*255 = N, then round +/- depending on decimal
For example, to get a 13% tint of rgb(228,217,185) or #e4d9b9:
r: (.13 * 228) + (1-.13)*255 = 251.49 round to 251 (or fa)
g: (.13 * 217) + (1-.13)*255 = 250.06 round to 250 (of fb)
b: (.13 * 185) + (1-.13)*255 = 245.9 round to 246 (or f6)
Thus tint:(rgb(228,217,185), 13%);
would result in a value of rgb(251,250,246)
or #fbfaf6
.
Thanks.