typestyle / csx

Utility functions for TypeStyle
https://typestyle.github.io
MIT License
102 stars 14 forks source link

csx .darken() improvements #14

Closed khkmzynv closed 7 years ago

khkmzynv commented 7 years ago

Now the percentage is calculated from the original color value, rather than the maximal value.

notoriousb1t commented 7 years ago

Currently there is a bit of a divide on this between preprocessors

SASS behavior: http://codepen.io/notoriousb1t/pen/de7584488ad5c7c458765bf5eaa056ec

LESS behavior: http://codepen.io/notoriousb1t/pen/d829544e445400b3becd5ffff0c78c04

Stylus behavior: http://codepen.io/notoriousb1t/pen/6d0442e17e4bb1d6f657cf7c766746de

I think that overloading darken would be the best way to incorporate both relative (used by Stylus) and absolute (used by SASS and LESS)

public darken(percent: string | number, relative?: boolean): ColorHelper
notoriousb1t commented 7 years ago

I changed the file to use an overload. I think this will provide a way to use either methodology.

khkmzynv commented 7 years ago

Great! Thanks @notoriousb1t :)