buntarb / closure-stylesheets

Automatically exported from code.google.com/p/closure-stylesheets
Apache License 2.0
0 stars 0 forks source link

Extra color functions #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

Some color functions are missing in closure stylesheets. If I take less in 
example, here are some interesting functions 
http://lesscss.org/#-color-functions

Based on the last commit 
(http://code.google.com/p/closure-stylesheets/source/detail?r=6edc1c4364256f20dc
a2b59eddc18e38f1a41935) I've implemented some of them :
* lighten(color, amount)
* darken(color, amount)
* saturate(color, amount)
* desaturate(color, amount)
* grayscale(color)

I join a patch which add functions. It's just a "quick and dirty" patch (based 
on the code of addHsbToCssColor), but it seems to work.
In the hope you find it interesting.

++
Yves

Original issue reported on code.google.com by Yves.Bri...@gmail.com on 2 Dec 2011 at 12:25

Attachments:

GoogleCodeExporter commented 9 years ago
Could you please upload this to codereview.appspot.com? Things are not 
configured to ingest contributions yet, but I will try my best.

In general, it would be easiest to follow the instructions on 
http://code.google.com/p/closure-compiler/wiki/Contributors, though 
http://code.google.com/p/closure-library/wiki/Contributors has more detailed 
instructions for using codereview.appspot.com.

Original comment by bolinf...@google.com on 2 Dec 2011 at 10:15

GoogleCodeExporter commented 9 years ago

Original comment by bolinf...@google.com on 2 Dec 2011 at 10:15

GoogleCodeExporter commented 9 years ago
OK. I'll clean a little the code (it's a little dirty and I've idea to do it 
better) and when it's good I'll upload on codereview. I think it will be 
available in the next days.

Original comment by Yves.Bri...@gmail.com on 6 Dec 2011 at 9:00

GoogleCodeExporter commented 9 years ago
Here is the patch uploaded to codereview : 
http://codereview.appspot.com/5468048/

I've update many things from the first patch (linked to this issue). 
Essentially by adding some HSL functions (Luminance is used to have a lighter / 
darker color).
Some tests has been written and the issue contains a little test case to see 
the usage of those functions.

Hope this can be usefull

Original comment by Yves.Bri...@gmail.com on 8 Dec 2011 at 8:14