-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Would love to add 'tint' to color functions #944
Comments
Those are color blending modes rather than a straight tint of color. As much as I'd like to say those would work, they don't address pure tints in RGB. That's what I'm looking for. Think a percentage of a single (or spot) color. Not blending with another color. It's an artifact from print that remains handy for creating a range of closely related colors. (I think this is a better explanation and solution for what #845 was asking for.) |
@tyhatch where did you get your formula? Using the one given on the link (calculate (255 - previous value), multiply that by 1/4, 1/2, 3/4, etc. and add that to the previous value),
Anyway, you got
Or, using HSL:
edit: scratch what I said. We already have a pretty clear way of achieving this:
As much as I would like to see a (I can still provide a patch/pull request if anybody really wants this implemented) |
So I did mixup Love that you have something figured out that would work with the current methods! I'll give that a shot. Been working on separating colors into their own .less file to make managing colors much simpler. Think something like
Then in my main.less file I bring them in with
That's why I'd love to have |
@ricardobeat As to where I got the formula, I played around with what was on the page and tinkered a bit on paper and with a calculator to check my math. I did look in on a help page for InDesign (http://j.mp/SrUNjy) which had some helpful hints too in guiding me in the right direction. (But CMYK is too easy to figure tints with...) I mean Adobe's got it figured out for their color palettes, so it can't be that difficult. ;) As I said, I'm not a math guy and so it was a very rough guess. I'm really glad there are better mathematicians out there than me. |
@ricardobeat Hadn't thought of using |
Maybe we should advertise this way of doing it in the documentation? We can also consider adding tint/shade as helper functions.. |
Tint/shade is not the same thing as lighten/darken. Tint and shade are effectively mixing with white and black respectively, whereas lighten/darken are manuipulating the luminance channel independently of hue and saturation. The former can produce hue shifts, whereas the latter does not. That's not to say it's not useful, just that it's not the same thing. Mathematically it's that linear changes in RGB space do not necessarily correspond with linear changes in HSL space, though in practice they will produce fairly similar results. |
In the js you could easily have a helper function that called mix |
I've added these functions and tests in pull request #947 - I can't figure out how to attach a pull request to an existing issue. |
added and in 1.3.1 |
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:
Thus
tint:(rgb(228,217,185), 13%);
would result in a value ofrgb(251,250,246)
or#fbfaf6
.Thanks.
The text was updated successfully, but these errors were encountered: