-
Notifications
You must be signed in to change notification settings - Fork 70
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
Handling of ANSI escape codes #197
Comments
This is news to me.
This is where I have concerns with supporting this, especially while |
Chromium DevTools did indeed support ANSI color codes, but not very well until recently. I've recently started to take inventory of what would be a reasonable subset to support for us (design doc) based on what's implemented in popular NPM libraries. We currently treat these ANSI escape sequences exactly like a TBH I do think that the use cases for So from my end, I'd be very much in favor of adding ANSI color codes to the standard, so that full-stack developers can rely on them to work in both worlds. The design doc calls out a reasonable subset of CSI SGR parameters to support. |
Yeah, the clashing between the ANSI codes and
I didn't get a chance to check Node, but I'm not even sure if it supports In any case, spec'ing these as style blocks feels like the most predictable solution. Unfortunately I do not have enough time to be able to spec this myself, @bmeurer is there any chance you'd be up for contributing? Although seeing as how underspecified |
I believe that color coding depends much on the OUTPUT used (actual concrete implementation of the console and the display target). Most likely the escape is processed not by the console but rather the terminal or display window. You could use |
A bug was filed recently about support for ANSI color codes in console.log in Firefox (Bug 1720116) where the reporter mentioned Chrome supporting ANSI color codes in
console.log
parameters.For example the following call:
will be rendered in red in Chrome (and Node I think), but not in Firefox nor Safari.
I took a look at the spec and I don't think there's anything about ANSI codes (sorry if I missed it).
It would be particularly interesting to define how those should play with
%c
.At the moment Chrome seems to treat them as another "style block" as in the following snippet
Hello
does have a yellow background, butRED
does not.The text was updated successfully, but these errors were encountered: