{"_id":"chalk-template@1.1.3","bugs":{"url":"https://github.com/chalk/chalk-template/issues"},"dist":{"shasum":"80bf50923cf24122dbbdf16b7a2662a970cbf173","tarball":"http://registry-npm.ywwl.com/chalk-template/download/chalk-template-1.1.3.tgz","fileCount":5,"integrity":"sha512-KDt7oQ+LRF2VLFsTAZd76ZNCKQa8LuW7SZkNJMkriMzvlSNj6dI+S+f41mfK9oTtil49seHVyabtt1753sFL2w==","signatures":[{"sig":"MEQCIAN2SRaQY+54C0m96tUY2C3fQiQ82pKNnMWydKieXa6/AiAiErnHP7vs1GvLGh2Cr6rWlGkAz5DfDcnd/8RbxU1s3w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC+3TM9L+93fFPnGyruoFlqvq8HfSnEj7QU6PYo20zcOAIhAI8TinXHJ1xX75gpXi8grhmDgjdcFzWKcvqp8zBKDdYD"}],"unpackedSize":14413,"size":4829,"noattachment":false,"key":"/chalk-template/-/chalk-template-1.1.3.tgz"},"name":"chalk-template","type":"module","types":"./index.d.ts","engines":{"node":">=14.16"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/chalk/chalk-template?sponsor=1","gitHead":"b8e99f4fb0a01ff21a58a5733f626d5a7bdc8955","license":"MIT","scripts":{"test":"xo && ava test/index.js && cross-env FORCE_COLOR=0 ava test/no-color.js && cross-env FORCE_COLOR=3 TERM=dumb ava test/full-color.js && cross-env FORCE_COLOR=3 TERM=dumb ava test/template.js && tsd"},"version":"1.1.3","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"homepage":"https://github.com/chalk/chalk-template#readme","keywords":["chalk","template","templates","templating","ansi","styles","color","colour","colors","terminal","console","string","tty","escape","formatting","rgb","256","shell","xterm","log","logging","command-line","text"],"repository":{"url":"git+https://github.com/chalk/chalk-template.git","type":"git"},"_npmVersion":"12.0.1","description":"Terminal string styling with tagged template literals","directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"sideEffects":false,"_nodeVersion":"26.9.0","dependencies":{"chalk":"^5.2.0"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^0.54.2","ava":"^5.2.0","tsd":"^0.28.1","cross-env":"^7.0.3"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/chalk-template_1.1.3_1790356856183_0.6444585478717895"},"readme":"# chalk-template\n\n> Terminal string styling with [tagged template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates)\n\n## Install\n\n```sh\nnpm install chalk-template\n```\n\n## Usage\n\nFor printing to standard output (stdout):\n\n```js\nimport chalkTemplate from 'chalk-template';\nimport chalk from 'chalk';\n\nconsole.log(chalkTemplate`\nCPU: {red ${cpu.totalPercent}%}\nRAM: {green ${ram.used / ram.total * 100}%}\nDISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}\n`);\n\nconsole.log(chalk.red.bgBlack(chalkTemplate`2 + 3 = {bold ${2 + 3}}`));\n\nconst miles = 18;\nconst calculateFeet = miles => miles * 5280;\n\nconsole.log(chalkTemplate`\n\tThere are {bold 5280 feet} in a mile.\n\tIn {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.\n`);\n\nconsole.log(chalkTemplate`\n\tThere are also {#FF0000 shorthand hex styles} for\n\tboth the {#ABCDEF foreground}, {#:123456 background},\n\tor {#ABCDEF:123456 both}.\n`);\n```\n\nFor printing to standard error (stderr):\n\n```js\nimport {chalkTemplateStderr} from 'chalk-template';\n\nconsole.error(chalkTemplateStderr`\nCPU: {red ${cpu.totalPercent}%}\nRAM: {green ${ram.used / ram.total * 100}%}\nDISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}\n`);\n```\n\n## API\n\nBlocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).\n\nTemplate styles are chained exactly like normal [Chalk](https://github.com/chalk/chalk) styles. The following two statements are equivalent:\n\n```js\nimport chalk from 'chalk';\nimport chalkTemplate from 'chalk-template';\n\nconsole.log(chalk.bold.rgb(10, 100, 200)('Hello!'));\nconsole.log(chalkTemplate`{bold.rgb(10,100,200) Hello!}`);\n```\n\nNote that function styles (`rgb()`, etc.) may not contain spaces between parameters.\n\nAll interpolated values (`` chalkTemplate`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.\n\n## Template function\n\nThis function can be useful if you need to wrap the template function. However, prefer the default export whenever possible.\n\n**Note:** It's up to you to properly escape the input.\n\n```js\nimport {template} from 'chalk-template';\n\nconsole.log(template('Today is {red hot}'));\n```\n\n```js\nimport {templateStderr} from 'chalk-template';\n\nconsole.error(templateStderr('Today is {red hot}'));\n```\n\n## Create template functions using a custom Chalk instance\n\nThe `makeTemplate` and `makeTaggedTemplate` functions are exported so functions can be created using a custom Chalk instance.\n\n**Note:** When using a function created with `makeTemplate`, it's up to you to properly escape the input.\n\n```js\nimport {Chalk} from 'chalk'\nimport {makeTemplate, makeTaggedTemplate} from 'chalk-template';\n\nconst template = makeTemplate(new Chalk({level: 3}));\nconst chalkTemplate = makeTaggedTemplate(new Chalk({level: 3}));\n\nconsole.log(template('Today is {red hot}'));\nconsole.log(chalkTemplate`Today is {red hot}`);\n```\n\n## Related\n\n- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right\n- [chalk-cli](https://github.com/chalk/chalk-cli) - Style text from the terminal\n\n## Maintainers\n\n- [Sindre Sorhus](https://github.com/sindresorhus)\n- [Josh Junon](https://github.com/qix-)\n","publish_time":1790356856256,"_cnpm_publish_time":1790356856256,"dist-tags":{"latest":"1.1.3"}}