shields icon indicating copy to clipboard operation
shields copied to clipboard

chore: replace `css-color-converter` with `color`

Open LitoMore opened this issue 4 months ago • 5 comments

It looks like the css-color-converter is lacking maintenance. Here I replaced the css-color-converter with the color library. The color library is pure ESM and more modern.

I'm also the maintainer of the color projects (color, color-convert, color-string). And the author of the color project Qix- is also the maintainer of the most popular ANSI color library - Chalk.

Here are some slight differences between color and css-color-converter:

color css-color-converter
rgb Yes Yes
rgba Yes Yes
hsl Yes Yes
hsla Yes Yes
CSS keywords Yes Yes
Hex colors Yes Yes
hwb Yes No
Negative values Yes No

I've updated the documentation for the new HWB support.

There are some unrelated changes because Prettier reported some code style problems while running npm test. I've fixed them with npx pretter --write ..

LitoMore avatar Aug 07 '25 12:08 LitoMore

Warnings
:warning: This PR modified service code for endpoint but not its test code.
That's okay so long as it's refactoring existing code.
:warning: This PR modified service code for static-badge but not its test code.
That's okay so long as it's refactoring existing code.
Messages
:book: :sparkles: Thanks for your contribution to Shields, @LitoMore!
:book:

Thanks for contributing to our documentation. We :heart: our documentarians!

Generated by :no_entry_sign: dangerJS against ce5097d6353828d62da8d22f50748c23c92f66d0

github-actions[bot] avatar Aug 07 '25 12:08 github-actions[bot]

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcolor@​5.0.010010010077100

View full report

socket-security[bot] avatar Aug 09 '25 14:08 socket-security[bot]

Thanks for catching the issue. I also noticed the upstream library color-string cannot recognize the no-comma HWB values. I've created a PR to fix it. Let's wait for the upstream to apply the fix.

LitoMore avatar Aug 10 '25 14:08 LitoMore

This is arguably a performance-sensitive part of our codebase, as it impacts the rendering of all badges. It would be great to do some quick performance analysis to make sure we aren't introducing overhead with the new library. :)

PyvesB avatar Sep 01 '25 16:09 PyvesB

Just wanted to add to my previous message: we do have some simple things in place to do micro-benchmarks, see this page in our docs!

PyvesB avatar Sep 21 '25 14:09 PyvesB