-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Color functions, amount argument handling improvement. #1669
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
Color functions, amount argument handling improvement. #1669
Conversation
…+ some minor reformatting)
…+ some minor reformatting)
…+ some minor reformatting)
…+ some minor reformatting)
So I agree it should have been done like this in the beginning. But is this a breaking change? anyone who has been lazy and left off % will get a surprise. In these functions in particular does over 100% make sense? We could possibly convert with a warning? Otherwise I'm afraid we will have to wait with this until we have a breaking change release. |
Yes, this is breaking change so if you feel that "one who left off % shouldn't be surprised" it's better to wait. Though I'd say such code is ill-formed and works only by mistake, since the current documentation specifies that:
...
No, since they either use +, - or simply replace corresponding hsla channel.
Yes, this makes sense if you expect such "left off %" code to be spread out there (i.e. does it deserve a dedicated conversion function? Though we need it anyway if we don't also want |
@lukeapage I thought of your idea about a "left off %" warning, indeed that's a good idea (we could first enable a warning without making any changes in next LESS version, and then we'll be free to make breaking changes later). The problem is that we don't have any "warning" facility yet :) How might that work? (won't this conflict with any tools built on top of the compiler? will they be able to distinguish warnings and errors? We could make warnings optional of course (e.g. with some command-line option) but that most likely would mean that nobody ever reads them :) |
…`%` and non-`%` amount argument.
…eration' functions (since they return with `hsla` which clamps every channel anyway).
Closed as outdated (I'll probably include this fix as part of some "bigger" feature later). |
This quick-fix is inspired by issue found in #1665:
Color functions with
amount
parameter now distinguish between%
and non-%
values.The following functions are changed:
Known issues: To keep things simple I reused existing
functions.js:number
goody. This function tests only for%
and non-%
values so for examplefade(#111, 1px)
gives same result asfade(#111, 1.0)
with no error thrown.