-
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
9 blending modes added as LESS operations #596
Conversation
…fference, exclusion, average & negation.
Alexis, you can bypass the |
I've been waiting forever for a some of these function, when I have to go from my Photoshop mock-up to the real thing, even though I always try to make the most flexible and dynamic design, I sometimes lack the power of multiply or difference. Really great add ! |
@Anahkiasen, that's the reason I got impulsed to add these blend effect, because I was converting my Mock-up from Adobe Fireworks into HTML5/CSS3, then I was missing a few blend modes such softlight to create new swatches from my original palette. I think this will be a good addition because now I can just replace the following code:
With the follwing:
Thanks for your comment. I appreciate the fact that this additions will be a help for others. |
@cloudhead, If you consider to include this addition I will be more than volunteer to prepare the documentation for each blend modes added, so you can include it into http://lesscss.org/. Also, I will not require as an obligation to throw my name in the credits. :) I just made it, because I love coding, and LESS is a great project that helps millions! |
Ooo, this plus the contrast function of Issue #488 could make for some really sexy templating. ^_^ |
@Synchro @MatthewDL do you agree this can be merged? I personally think having powerful color functions fits well into less and how to keep it declarative and still powerful. @rmariuzzo - @cloudhead has a project for the website documentation - maybe you could open a pull request there. |
Nice to heard that. I will be more than interesting into adding/updating Contrast and luma? I will check it up. Rubens Mariuzzo
|
Added ticket for contast/luma docs in #895 |
And I'm +1 for pulling this. |
Well, having a second look at this, I feel like these would all need significant documentation as far as what they mean compared to their, say, Photoshop counterparts. I worry this could cause confusion for someone who falsely thinks that by applying one of these, their element would have the same type of blending on the page. When, in reality, I think these are just color blending algorithms for two individual colors? Is that correct? I'd like to see documentation first. For instance, how does "softlight" differ from "lighten", and what makes it necessary? |
Yes, they are just applied to two individual colours; it's akin to what photoshop would do with a single pixel. |
Incidentally I think #785 should be closed as a dupe. |
ok, pulled, on my head be it. |
@rmariuzzo - care to write something for less/old-lesscss.org#26 ? |
Oh this is already pulled? Did we get @cloudhead's input? These seem like a big deal, and I still don't feel like I have my head wrapped around what they would do or exactly what possibilities they open up. I fear this may introduce confusion and complexity into something that's been kept as simple as LESS. Bottom line: I cringe at anything that looks like LESS becoming SASS. |
In addition, these may be good candidates for solidifying: a) A plugin syntax and documentation (writing any functions that can be interpreted by LESS as valid keywords), If LESS had a solid documented plugin architecture, then a lot of these extra helper functions could easily be integrated without expanding LESS core. So, I'm not saying these definitely DON'T belong, but if we had a plugin architecture in LESS that was supported by all compilers, would they more legitimately go there? |
Sorry, I didn't realise you objected.. can you get to the bottom of a I am of the opinion that any functions that make it easier to build a set |
I don't object outright. I just want us to be conservative. It can seem harmless to add extra functions, but as an overall product, each new function is an extra chunk of documentation for someone to sift through. I don't have a clear sense of the value of these functions compared to the existing functions in LESS, so that to me is the balancing act. Do these add enough value to justify adding complexity? If the complexity added is small, or the value added is high, then that gives it some weight. The second issue I have with it, which may be more important, is that, to me, these are functions that don't have an intuitive output vs. the existing color functions, which do. A developer is less likely to understand "softlight" without several examples and trial and error, whereas "fadeout" or "darken" or "mix" are a lot easier to understand. So, for me, this may come down to documentation. Is it simple to understand? Is it intuitive? Or will it add confusion and complexity? If it's the latter, then to me, the extra value may not be worth it. Having said that, I fully understand that it may be HIGHLY valued by someone creating templated libraries, so there's that balance too, and I'm all for providing more tools, just as you said. So then the question is what is the best way to provide that flexibility with adding the lowest complexity and the least chance of confusion to developers new to LESS. In the end, I'd probably fall on the side of supporting something like this, but I want to see it done in the smartest way, so I'd love more input / discussion on what that might be. |
Your additional suggestion sounds good.. but who's going to do it? And btw. I did exactly this for dotless. |
Which part sounds good? What was it you did for dotless? |
Allow plugins to extend the base functions and better config which allows |
Cool. Then maybe we could separately discuss plugin / configuration syntax, something that works for all parsers and compiling environments, and make a specific recommendation. |
Plugins do seem like an obvious way to go - most of the changes I've wanted could have been done by plugins as they are not core functionality (i.e. involving translation of generic LESS markup to CSS). I've seen other projects move to plugin-based architecture before, usually by shrinking core operations and devolving 'functions' into plugins, and that's generally been achieved without breaking BC; I don't know if that could be done with LESS. In the mean time I don't think we should be too shy about adding functions to core since there's nowhere else to put them for now. That said, I don't think that functions should necessarily be rejected because they're not common. Colour is obviously a very important part of CSS, and there may be colour processing functions that are unfamiliar to many; much the same thing may be said of 3D or audio functions which are likely to be applicable to CSS generation too. Since LESS can manipulate colours as in any other colour-oriented environment, similar functions should be made available. It's trivial in CSS to specify a colour value, but how that value was arrived at may involve far more complexity. I don't think code size is a major factor either: execution speed on the server is almost irrelevant since it happens relatively rarely and so long as it doesn't take more than a few seconds it should be fine. Client-side execution is more of an issue, but does that really get much use outside dev environments? Also it doesn't matter whether a function is implemented in core or a plugin - it will need documenting either way. |
All good points. I retract my conservatism. Especially because I got this message from @cloudhead this morning: if you have time, could you look into integrating this: Plus... the more I thought about it this morning, part of the core of LESS I'd like to see is a rock-solid foundation for templating libraries (like Bootstrap). A variety of color functions is not a bad idea in that context. You can still expect me to be conservative on new features. I don't mind being the voice of "Whoa whoa SLOW DOWN PEOPLE!" So, yep, let's do this. And let people use these as they may. |
Oh, and of course, please add @cloudhead's color function if it doesn't match one of the ones already committed. |
Hi Alexis,
If it is not out of the LESS project scope, you may feel free to add these 9 blending modes.
I also created the test cases, and it works like a clock.