Skip to content

TTY detection foreground color #65058

Description

@jdmarshall

What is the problem this feature will solve?

For tty’s if you output any text in black, particularly when doing TUI’s one is likely to get a rude awakening when they discover that their users are using dark mode and none of that text is visible because it’s jet black on a charcoal gray background. It would be best in such cases to simply print this text in the default foreground color, but that is difficult to do within Node without pulling in a third party library.

What is the feature you are proposing to solve the problem?

Add a function to write stream to query the foreground color the way color depth can be queried.

What alternatives have you considered?

Workarounds include:

  • setting a background color and printing over it, but that makes the text/graphic look more important than it is
  • resetting the tty codes rather than setting “black” - but this fails if you are looking for a more general case of high contrast colors, like dark gray on a bright background and light gray on a dark one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Projects

    Status
    Awaiting Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions