Skip to content

util.styleText(): Combining multiple styles in a single string? #52035

Description

@rauschma

What is the problem this feature will solve?

Currently, using multiple styles with util.styleText() is slightly verbose:

console.log(
  util.styleText('bold', util.styleText('red', 'Bold and red!')),
); 

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

Maybe multiple styles per format string could be supported – e.g.:

console.log(
  util.styleText('bold+red', 'Bold and red!'),
); 

Downside: It would make autocomplete in IDEs less straightforward if not impossible.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.utilIssues and PRs related to the built-in util module.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions