A picture is worth a thousand words → https://i.imgur.com/inxA7Pg.png
The library inserts ANSI escape sequences [1] between the text you want to colorize in order to, well, colorize it ¯\_(ツ)_/¯
Many people are obsessed with colors in the Terminal, and so, they reach out to libraries like this. They exist in every major programming language ecosystem, even though colorizing text is as simple as writing this \x1b[48;5;011<TEXT>\x1[0m . One of the disadvantages of this rudimentary colorization technique is that if you have short-term memory, you will quickly forget the meaning of these numbers, but you can solve that problem with constants, there is no reason to install a third-party library with potentially malicious code to add this type of functionality to a high-profile project like AWS-CDK [2].
I wish these libraries would support NO_COLOR [3] more consistently.
I have seen many “modern” CLI tools (the ones people like to build using Rust or Go) overuse colors with no option to disable them.
[1] https://stackoverflow.com/a/33206814