closure-stylesheets icon indicating copy to clipboard operation
closure-stylesheets copied to clipboard

Extra color functions

Open iflan opened this issue 10 years ago • 6 comments
trafficstars

Originally reported on Google Code with ID 9

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=6edc1c4364256f20dca2b59eddc18e38f1a41935)
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

Reported by Yves.Brissaud on 2011-12-02 12:25:33


- _Attachment: [extra_colors.patch](https://storage.googleapis.com/google-code-attachments/closure-stylesheets/issue-9/comment-0/extra_colors.patch)_

iflan avatar Oct 23 '15 20:10 iflan

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.

Reported by [email protected] on 2011-12-02 22:15:12

iflan avatar Oct 23 '15 20:10 iflan

Reported by [email protected] on 2011-12-02 22:15:41

  • Labels added: Type-Enhancement
  • Labels removed: Type-Defect

iflan avatar Oct 23 '15 20:10 iflan

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.

Reported by Yves.Brissaud on 2011-12-06 09:00:53

iflan avatar Oct 23 '15 20:10 iflan

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

Reported by Yves.Brissaud on 2011-12-08 20:14:00

iflan avatar Oct 23 '15 20:10 iflan

@eunomie, I believe that this was your original issue and patch. If you're still interested, can you make a pull request with the updated patch? Yes, I know, it's been nearly 4 years, so if you don't care to, I completely understand. Just say so and I'll close out this bug.

iflan avatar Oct 26 '15 11:10 iflan

Thanks for reporting my old issue :-)

See #66 for the PR.

eunomie avatar Oct 26 '15 21:10 eunomie