镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
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.

No activity

Activity on this issue will appear here.

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