Skip to content
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

🚀 Feature: Replace ansi-colors with a faster, smaller alternative #5291

Open
3 tasks done
JoshuaKGoldberg opened this issue Feb 5, 2025 · 3 comments
Open
3 tasks done
Labels
status: accepting prs Mocha can use your help with this one! type: feature enhancement proposal

Comments

@JoshuaKGoldberg
Copy link
Member

Feature Request Checklist

Overview

Coming over from #5274 ansi-colors has a couple issues:

  • It was last updated 3 years ago
  • Is >2.5x the unpacked package size (26.1 kB) than the two smallest alternatives: ansis (6.8 kB) and picocolors (6.4 kB)

Suggested Solution

I personally propose switching to picocolors. It's the smallest of the popular alternatives that I know of. It's also quite widely used at ~60m+ weekly downloads, showing it should be stable enough for Mocha.

Alternatives

ansis is great too. It's only marginally larger than picocolors, with a small enough difference that they're effectively the same. And at ~1m weekly downloads it's pretty popular in its own right.

Additional Info

💖

Co-authored-by: @webdiscus

@JoshuaKGoldberg JoshuaKGoldberg added status: in triage a maintainer should (re-)triage (review) this issue type: feature enhancement proposal labels Feb 5, 2025
@webdiscus
Copy link

Since Mocha uses only single colors, Picocolors is the best choice for this use case. In this case, Ansis has no advantage over Picocolors. However, Ansis is better suited for more complex use cases, when, e.g. using ANSI 256 or Truecolor.

So, I'm for migration to Picocolors, it’s a reasonable decision.

@JoshuaKGoldberg
Copy link
Member Author

cc @mochajs/committers - WDYT about going with Picolors?

@mark-wiemer
Copy link
Contributor

picocolors looks good to me esp as it explicitly supports old node versions :)

@JoshuaKGoldberg JoshuaKGoldberg added status: accepting prs Mocha can use your help with this one! and removed status: in triage a maintainer should (re-)triage (review) this issue labels Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Mocha can use your help with this one! type: feature enhancement proposal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants