-
Notifications
You must be signed in to change notification settings - Fork 2
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
Replace chalk
with picocolors
#132
Comments
I've looked at making this update for lint-staged but hit a stumbling block. lint-staged makes use of supportsColor - bundled and exported by chalk - but picocolors doesn't offer an equivalent. I suppose I could use the supports-color package but then I'd be adding a dependency. Have others come across this situation? |
@alexparish I would go for the package directly. I don't think we have a micro lib for this use case yet. Maybe ask on the discord if anyone wants to write one :D |
Reading through the source, We could use it for now, but I think the way to go is having a small library of colour related utils. We should avoid creating micro packages, and should aim for an alternative that groups utils in that space I think |
|
Apparently you can use node's own built in function for colour detection now: https://nodejs.org/api/tty.html#writestreamhascolorscount-env |
@43081j |
It does. Part of where it has gone off the rails IMO We should be checking if a terminal supports colours through the "official" methods. The rest seem like edge cases people have stuck on over time E.g. it checks cli args. It shouldn't, some other library or the consumer should do that I think part of migrating away from it should be to investigate (per project) if any of that is actually needed and do it from outside if so (but I suspect it isn't) |
@babel/highlight can perhaps be removed from this list now (or marked somehow). Since it has been inlined into @babel/code-frame where picocolors is now also used: So the remaining work is just prompting dependents to upgrade their babel, I suppose. |
@stianjensen yeah we had a discussion about that on the discord. People need to update their |
@webdiscus happy to discuss this on our discord (https://chat.e18e.dev/). Please refrain from commenting on PRs to push this discussion especially when your arguments don't apply in the PRs case and all work is already done by a community member. |
This comes down to preference in the end Both ansis and picocolors are fast and small (and faster than each other in different cases). Most migrations have been to picocolors so far. If a maintainer particularly wants the syntax ansis uses, that's when we'd switch. Both are recommended by the community. Though the first choice is generally picocolors. Anyhow, fuzzy is right, we should use the discord if we want to discuss it more (so others can more easily get involved) |
A lot of usecases of chalk can be migrated to the smaller picocolors package.
Here is a list of the top 100 dependents sorted by downloads last month.
@babel/highlightThe text was updated successfully, but these errors were encountered: