Nice deep dive by Axel Rauschmayer on util.styleText() in Node.js. Clean way to handle ANSI styling natively. No deps needed.
https://2ality.com/2025/05/ansi-escape-sequences-nodejs.html
Styling console text in Node.js

In this blog post, we explore how we can style text that we log to the console in Node.js. Some of the examples use a Unix shell but most of the code should also work on Windows.