Skip to content

Conversation

@LitoMore
Copy link
Contributor

@LitoMore LitoMore commented Aug 7, 2025

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 ..

@github-actions
Copy link
Contributor

github-actions bot commented Aug 7, 2025

Warnings
⚠️ This PR modified service code for endpoint but not its test code.
That's okay so long as it's refactoring existing code.
⚠️ 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
📖 ✨ Thanks for your contribution to Shields, @LitoMore!
📖

Thanks for contributing to our documentation. We ❤️ our documentarians!

Generated by 🚫 dangerJS against ce5097d

Copy link
Member

@jNullj jNullj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a good idea to migrate, please consider starting a discussion prior to a PR next time, just to avoid a situation where a done PR is not accepted as a discussion might not result in accepting a migration.

The code looks good, but seems the old package was not removed.
Once removed I will run some tests and we can make a release.

@LitoMore LitoMore force-pushed the use-modern-color-lib branch from 3ed1772 to c5398ec Compare August 9, 2025 14:03
@socket-security
Copy link

socket-security bot commented Aug 9, 2025

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

@LitoMore LitoMore requested a review from jNullj August 9, 2025 14:06
@LitoMore LitoMore force-pushed the use-modern-color-lib branch from c5398ec to cf3f31f Compare August 9, 2025 14:18
Copy link
Member

@jNullj jNullj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note changes proposed at LitoMore#1088
Also, while testing it appears hwb in static badge is black for any color.

@LitoMore LitoMore force-pushed the use-modern-color-lib branch from cf3f31f to ce5097d Compare August 10, 2025 14:00
@LitoMore
Copy link
Contributor Author

LitoMore commented Aug 10, 2025

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.

@PyvesB
Copy link
Member

PyvesB commented Sep 1, 2025

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
Copy link
Member

PyvesB commented Sep 21, 2025

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 PyvesB added the core Server, BaseService, GitHub auth, Shared helpers label Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Server, BaseService, GitHub auth, Shared helpers

3 participants