-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
Open
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.
Description
What is the problem this feature will solve?
Many userland projects use manual hex codes for color printing to the terminal. 256 and true color printing in supported terminals is supported in several libraries that existed prior to util.styleText. For example:
ansis: supports 256 and truecolor support with fallbacks to base 16 colorschalk: has full 256 and truecolor support with fallbacks to terminal-supported levelsgradient-string: dedicated library for terminal gradients (see their 'who uses gradient string' for some pretty examples)
However, util.styleText only supports the standard 16 colors.
What is the feature you are proposing to solve the problem?
Could util.styleText take in hex codes?
styleText('#ffcc00', 'Success!');They could be detected as anything starting with #.
What alternatives have you considered?
Userland code could stick with raw hex code printing. But that's rather inconvenient and error-prone. Plus, functions like styleText respect the NO_COLOR, NODE_DISABLE_COLORS and FORCE_COLOR environment variables.
Was this discussed in the design of styleText? I searched around and couldn't find it.
lishaduck, Delapouite and ljharb
Metadata
Metadata
Assignees
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.
Type
Projects
Status
Awaiting Triage