MichaelFenwick / Color

A simple Dart package exposing a Color class which can be used to create, convert, and compare colors.
http://pub.dartlang.org/packages/color
MIT License
52 stars 18 forks source link

Generate lighter or darker color #5

Closed GeReinhart closed 9 years ago

GeReinhart commented 9 years ago

Like in http://www.sitepoint.com/javascript-generate-lighter-darker-color/

Would be very useful.

MichaelFenwick commented 9 years ago

Something I have been thinking about for a while. It makes sense to support a lighter() and darker() method by changing the Luminance while in HSL space. The question is what arguments that should take, and if it should be linear or perhaps some percentage of its current brightness. Still not sure what to do there, which is why I haven't added it yet. In the meantime, you can convert a Color to an HslColor and set the luminance directly.

GeReinhart commented 9 years ago

I was thinking of a percentage as a parameter. Thanks for the trick with HslColor.