Feedback Desired: Color Functions

Skip to first unread message

Chris Eppstein

Nov 16, 2009, 4:19:06 AM11/16/09
If you've not yet heard, the sass functions provided by the compass-colors plugin are moving into the Sass core.  Based on some feedback I've received and discussions with Nathan, there are going to be some changes to the existing API.

In particular, the saturate, desaturate, lighten, and darken functions current work by allowing you pass a percentage to change the color by. However, this means that the color you get as a result is not easy to predict and the change is hard to invert. So the plan is to make these functions accept a number between 0-100 but make the change be an absolute adjustment. New functions by the same name but preceded by "percent-" will be added to preserve the old behavior if you're currently relying on it.

Some examples:

>> darken(#777, 50)
>> percent-darken(#777, 50)
>> saturate(#393, 50)
>> percent-saturate(#393, 50)
>> desaturate(saturate(#393, 50), 50)
>> percent-desaturate(percent-saturate(#393, 50), 50)

Please let me know if you have any opinions on this change.


G. D. Speer

Nov 16, 2009, 9:37:47 AM11/16/09
Makes sense to me, will be more useable.
I would have expected 'percent' to be appended instead of prepended so the primary function is read first, the modifier is second, and that when commands are listed alphabetically, related commands sort together, but that's a minor aesthetic.


You received this message because you are subscribed to the Google Groups "Compass" group.
To post to this group, send email to
For more options, visit this group at

No virus found in this incoming message.
Checked by AVG -
Version: 8.5.425 / Virus Database: 270.14.66/2504 - Release Date: 11/15/09 07:50:00

Andrew Vit

Nov 16, 2009, 2:13:58 PM11/16/09
This is awesome! A great addition to core Sass.

I like how the color adjustments are reversible.

Andrew Vit

Reply all
Reply to author
0 new messages