-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sass library equivalent #5
Labels
Comments
Take a look at color. I do use that one currently. |
@ArthruClemens also mentioned https://github.com/bgrins/TinyColor which clocks at 6K mingzipped, while https://github.com/harthur/color is at 3K. I'll try to get lower still, not sure if it's possible. |
https://github.com/One-com/one-color 2.8kb mingzipped |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be useful to provide as a companion library functions that tweak colors (
lighten('#f00', 0.2)
) and do arithmetic on sizes (add('2em', '0.5em')
ormul('3px', 2)
).This issue is there to discuss the specifics. I'd like to keep the gzipped size as small as possible, of course.
add
andsub
take two measures with the same unit.mul
anddiv
take a measure and a number.both return a measure of the same unit as the input.
#ff0000
formated color of possible andrgba()
otherwise.Taking inspiration on the Sass standard library, I'd borrow
adjust-color
,scale-color
andchange-color
but split them into*-rgba
and*-hsla
versions. You can't change both rgb and hsl using the original, anyway, and the long parameter list makes them unusable in practice.Maybe also provide
rgba
andhsla
constructors (thea
being optional)? Do they return color strings or{r, g, b, a}
/{h, s, l, a}
objects? The former means that their output can be fed to j2c, but the latter means that we can skip the parse step in the color modifying functions. We could usevalueOf
to make'' + rgba(...)
return a string. Make them accept color strings, and they also do the job of the rgba and hsl getters of Sass.Feedback most welcome :-)
The text was updated successfully, but these errors were encountered: