chalk template strings
See original GitHub issueConsider running stuff through the chalk template function like this:
const chalk = require('chalk');
const chalkTemplate = require("chalk/templates");
const myString = "{red RED}";
console.log(chalkTemplate(chalk, myString));
Which is slightly less ugly, but still hacky.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
chalk-template - GitHub
All interpolated values ( chalkTemplate`${foo}` ) are converted to strings via the .toString() method. All curly braces ( { and } ) in...
Read more >chalk-template - npm
Terminal string styling with tagged template literals. ... Start using chalk-template in your project by running `npm i chalk-template`.
Read more >chalk tagged template literals within strings - Stack Overflow
i would like chalk to honor my string as it would honor tagged termplate literals. how can it be done? const chalk =...
Read more >Using Chalk 2.0's Tagged Template Literals For Nested ...
Ben Nadel explores the use of ES6 tagged template literals in the recently-released Chalk 2.0 node module. This feature allows complex, ...
Read more >chalk-template - npm Package Health Analysis - Snyk
Terminal string styling with tagged template literals For more information about how to use this package see README. Latest version published 10 months...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fine. How about this then:
That uses the ES2015 template literal API (not 100% to spec, but it works) and it doesn’t use any undocumented chalk features.
If you’d want to do it to spec you’d have to go and replace all all escape sequences in
raw
with their literal values, but chalk handles that fine anyways.i’m back from holiday now (although still jet-lagged!) and have implemented the
raw
property solution in v5.0.4, as suggested… thanks again, keep me posted.