←back to thread

1369 points universesquid | 7 comments | | HN request time: 0.001s | source | bottom
Show context
tomxor ◴[] No.45170819[source]
Finally validated for writing my own damn ANSI escape codes.
replies(1): >>45173233 #
1. jmull ◴[] No.45173233[source]
Yeah, I get that learning the codes is a little annoying, but not actually harder than finding, incorporating, and learning one of the APIs here. Also one is standard while the other is not. Seems a bit nuts to use a package for this.
replies(2): >>45173971 #>>45184261 #
2. junon ◴[] No.45173971[source]
Hi, missing a lot of history here. When Chalk was written, colors in the terminal wasn't a flashy thing people tried to do very often, at least not in the JS world. Coming from browsers and wanting to make CLI apps using the flashy new Node.js 0.10/0.12 at the time saw a lot of designers and other aesthetically-oriented folks with it. Chalk filled a hole for people to do that without needing to understand how TTYs worked.

Node.js proper has floated the idea of including chalk into the standard libraries, FWIW.

replies(2): >>45176413 #>>45181074 #
3. herpdyderp ◴[] No.45176413[source]
> Node.js proper has floated the idea of including chalk into the standard libraries, FWIW.

Oh my word please no! Every time I run into an issue where a dependency suddenly isn’t logging colors like it’s supposed to, it always boils down to chalk trying to do something fancy to handle an edge case that doesn’t actually exist. Just log the dang colors!

replies(1): >>45179323 #
4. junon ◴[] No.45179323{3}[source]
I'd be curious what those edge cases are, as a maintainer of chalk.
5. jmull ◴[] No.45181074[source]
I doubt we'll ever see eye-to-eye on this. Some people try to think about how to write less code, and some people try to think about how to write more code.
replies(1): >>45184079 #
6. junon ◴[] No.45184079{3}[source]
We probably don't disagree, to be honest. Some of these packages shouldn't exist, I'll be the first to say it.
7. int_19h ◴[] No.45184261[source]
I would argue that ANSI color output should be something natively supported in stdlib for any general purpose or systems programming language today. Precisely for this reason - it has been a standard for a very long time, and for several years now (since Windows enabled it by default) it is a truly universal standard de facto as well. This is exactly the kind of stuff that stdlib should cover.