voxpelli / sass-color-helpers

A collection of Sass color helpers that enables easier, more fool-proof design implementations (+ some math helpers)
92 stars 9 forks source link

Update to Dart Sass and Sass modules #11

Open dawaltconley opened 1 year ago

dawaltconley commented 1 year ago

Resolves #9, resolves #10, and maybe #3. I couldn't get the old tests working with bootcamp & grunt, so I rewrote them using sass-true and jest. I also added a number of others in order to confirm that the update hasn't changed things. I'm not sure whether all the results are intended---the calculate-alpha function sometimes returns Infinity or NaN---but at least they haven't changed.

The last commit is admittedly an aesthetic change / not needed to resolve deprecation: it drops the ch- prefix from function names since scoping is now handled by the module system, and can be re-added using @forward 'sass-color-helpers' as ch-*;. This is breaking in that anyone using the current version in dart sass will need to re-add those prefixes to keep their functions working as-is. If that's a concern, it could be made non-breaking by having two entrypoints: the old one can @forward all functions with the prefix, and the new one (_index.scss, rationale here) can forward them without the prefix. Not sure whether this is worth the potential for confusion.

Thank you for this package btw, the color contrast functions have proven very useful!