Skip to content

Handling of ANSI escape codes #197

Open
@nchevobbe

Description

@nchevobbe

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:

console.log(`\u001B[31mThis will be a red string in Chrome`);

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

console.log("%cHello \u001B[31mRED", "background-color: yellow")

Hello does have a yellow background, but RED does not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions