Feedback Desired: Color Functions

6 views
Skip to first unread message

Chris Eppstein

unread,
Nov 16, 2009, 4:19:06 AM11/16/09
to compas...@googlegroups.com
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)
black
>> percent-darken(#777, 50)
#3c3c3c
>> saturate(#393, 50)
#00cc00
>> percent-saturate(#393, 50)
#1ab319
>> desaturate(saturate(#393, 50), 50)
#339933
>> percent-desaturate(percent-saturate(#393, 50), 50)
#408c40

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

Chris

G. D. Speer

unread,
Nov 16, 2009, 9:37:47 AM11/16/09
to compas...@googlegroups.com
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 compas...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/compass-users?hl=.



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

Andrew Vit

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

I like how the color adjustments are reversible.

Andrew Vit



Reply all
Reply to author
Forward
0 new messages