{"_id":"chalk-template","_rev":"4583738","name":"chalk-template","description":"Terminal string styling with tagged template literals","dist-tags":{"latest":"1.1.2"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2026-04-10T16:24:01.000Z","created":"2017-01-19T21:40:09.895Z","1.1.2":"2025-09-08T15:13:28.338Z","1.1.0":"2023-05-23T09:15:14.781Z","1.0.0":"2023-03-18T12:39:11.115Z","0.5.0":"2022-12-26T12:15:33.873Z","0.4.0":"2022-03-04T17:24:41.296Z","0.3.1":"2022-01-18T05:27:45.804Z","0.3.0":"2022-01-17T17:51:39.843Z","0.2.0":"2021-11-04T10:48:12.060Z","0.1.0":"2017-01-19T21:40:09.895Z"},"users":{},"repository":{"type":"git","url":"git+https://github.com/chalk/chalk-template.git"},"versions":{"1.1.2":{"name":"chalk-template","version":"1.1.2","description":"Terminal string styling with tagged template literals","license":"MIT","repository":{"type":"git","url":"git+https://github.com/chalk/chalk-template.git"},"funding":"https://github.com/chalk/chalk-template?sponsor=1","type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"engines":{"node":">=14.16"},"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"},"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"],"dependencies":{"chalk":"^5.2.0"},"devDependencies":{"ava":"^5.2.0","cross-env":"^7.0.3","tsd":"^0.28.1","xo":"^0.54.2"},"_id":"chalk-template@1.1.2","gitHead":"ac2a35ff5f45e213b99987e8142fe568d74c4dd2","types":"./index.d.ts","bugs":{"url":"https://github.com/chalk/chalk-template/issues"},"homepage":"https://github.com/chalk/chalk-template#readme","_nodeVersion":"22.12.0","_npmVersion":"10.9.2","dist":{"shasum":"88ff13e75a333d232304e13abc48c5b5be15f1ce","size":4527,"noattachment":false,"key":"/chalk-template/-/chalk-template-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/chalk-template/download/chalk-template-1.1.2.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/chalk-template_1.1.2_1757344408143_0.19414870130079298"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-09-08T15:13:28.338Z","publish_time":1757344408338,"_source_registry_name":"default","_cnpm_publish_time":1757344408338},"1.1.0":{"name":"chalk-template","version":"1.1.0","description":"Terminal string styling with tagged template literals","license":"MIT","repository":{"type":"git","url":"git+https://github.com/chalk/chalk-template.git"},"funding":"https://github.com/chalk/chalk-template?sponsor=1","type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"engines":{"node":">=14.16"},"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"},"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"],"dependencies":{"chalk":"^5.2.0"},"devDependencies":{"ava":"^5.2.0","cross-env":"^7.0.3","tsd":"^0.28.1","xo":"^0.54.2"},"types":"./index.d.ts","gitHead":"9df4f4f58d4c556250f51fd6d631c99d75043e34","bugs":{"url":"https://github.com/chalk/chalk-template/issues"},"homepage":"https://github.com/chalk/chalk-template#readme","_id":"chalk-template@1.1.0","_nodeVersion":"14.21.3","_npmVersion":"9.2.0","dist":{"shasum":"ffc55db6dd745e9394b85327c8ac8466edb7a7b1","size":4494,"noattachment":false,"key":"/chalk-template/-/chalk-template-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/chalk-template/download/chalk-template-1.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/chalk-template_1.1.0_1684833314596_0.5373875780358752"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-05-23T09:15:14.781Z","publish_time":1684833314781,"_source_registry_name":"default","_cnpm_publish_time":1684833314781},"1.0.0":{"name":"chalk-template","version":"1.0.0","description":"Terminal string styling with tagged template literals","license":"MIT","repository":{"type":"git","url":"git+https://github.com/chalk/chalk-template.git"},"funding":"https://github.com/chalk/chalk-template?sponsor=1","type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"engines":{"node":">=14.16"},"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"},"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"],"dependencies":{"chalk":"^5.2.0"},"devDependencies":{"ava":"^5.2.0","cross-env":"^7.0.3","tsd":"^0.27.0","xo":"^0.53.1"},"types":"./index.d.ts","gitHead":"d12eec4cc7fccdacead2adfdc122e4f3f9b5d681","bugs":{"url":"https://github.com/chalk/chalk-template/issues"},"homepage":"https://github.com/chalk/chalk-template#readme","_id":"chalk-template@1.0.0","_nodeVersion":"18.14.2","_npmVersion":"9.2.0","dist":{"shasum":"8f2a13952f1f192c4e7f3e8cf4c75238f7a13412","size":4256,"noattachment":false,"key":"/chalk-template/-/chalk-template-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/chalk-template/download/chalk-template-1.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/chalk-template_1.0.0_1679143151000_0.775202483661181"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-03-18T12:39:11.115Z","publish_time":1679143151115,"_cnpm_publish_time":1679143151115},"0.5.0":{"name":"chalk-template","version":"0.5.0","description":"Terminal string styling with tagged template literals","license":"MIT","repository":{"type":"git","url":"git+https://github.com/chalk/chalk-template.git"},"funding":"https://github.com/chalk/chalk-template?sponsor=1","type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"engines":{"node":">=14.16"},"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"},"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"],"dependencies":{"chalk":"^4.1.2"},"devDependencies":{"ava":"^5.1.0","cross-env":"^7.0.3","tsd":"^0.25.0","xo":"^0.53.1"},"types":"./index.d.ts","gitHead":"f2b34e84e1a4730e5cb12b3b7892a1911fcf421e","bugs":{"url":"https://github.com/chalk/chalk-template/issues"},"homepage":"https://github.com/chalk/chalk-template#readme","_id":"chalk-template@0.5.0","_nodeVersion":"14.21.1","_npmVersion":"8.19.2","dist":{"shasum":"fc4051675895e931eacf7f9a5f38763824c2d543","size":4247,"noattachment":false,"key":"/chalk-template/-/chalk-template-0.5.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/chalk-template/download/chalk-template-0.5.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/chalk-template_0.5.0_1672056933682_0.5273739612431967"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-12-26T12:15:37.840Z","publish_time":1672056933873,"_cnpm_publish_time":1672056933873},"0.4.0":{"name":"chalk-template","version":"0.4.0","description":"Terminal string styling with tagged template literals","license":"MIT","repository":{"type":"git","url":"git+https://github.com/chalk/chalk-template.git"},"funding":"https://github.com/chalk/chalk-template?sponsor=1","type":"module","exports":"./index.js","engines":{"node":">=12"},"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"},"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"],"dependencies":{"chalk":"^4.1.2"},"devDependencies":{"ava":"^3.15.0","cross-env":"^7.0.3","tsd":"^0.18.0","typescript":"^4.6.2","xo":"^0.45.0"},"types":"./index.d.ts","gitHead":"3c973c32ac9f1476d41dfb1bee362d196318eb7f","bugs":{"url":"https://github.com/chalk/chalk-template/issues"},"homepage":"https://github.com/chalk/chalk-template#readme","_id":"chalk-template@0.4.0","_nodeVersion":"17.3.1","_npmVersion":"8.3.0","dist":{"shasum":"692c034d0ed62436b9062c1707fadcd0f753204b","size":4001,"noattachment":false,"key":"/chalk-template/-/chalk-template-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/chalk-template/download/chalk-template-0.4.0.tgz"},"_npmUser":{"name":"qix","email":"josh@junon.me"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/chalk-template_0.4.0_1646414680946_0.40062758308818713"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-03-04T18:07:44.406Z","publish_time":1646414681296,"_cnpm_publish_time":1646414681296},"0.3.1":{"name":"chalk-template","version":"0.3.1","description":"Terminal string styling with tagged template literals","license":"MIT","repository":{"type":"git","url":"git+https://github.com/chalk/chalk-template.git"},"funding":"https://github.com/chalk/chalk-template?sponsor=1","type":"module","exports":"./index.js","engines":{"node":">=12"},"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 && tsd"},"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"],"dependencies":{"chalk":"^4.1.2"},"devDependencies":{"ava":"^3.15.0","cross-env":"^7.0.3","tsd":"^0.18.0","xo":"^0.45.0"},"types":"./index.d.ts","gitHead":"bc92e9307d60f48b065a5725c53ec0c37cc884a1","bugs":{"url":"https://github.com/chalk/chalk-template/issues"},"homepage":"https://github.com/chalk/chalk-template#readme","_id":"chalk-template@0.3.1","_nodeVersion":"17.3.1","_npmVersion":"8.3.0","dist":{"shasum":"9511cd31ec3c4911448410d49645526c1c7a3a22","size":3818,"noattachment":false,"key":"/chalk-template/-/chalk-template-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/chalk-template/download/chalk-template-0.3.1.tgz"},"_npmUser":{"name":"qix","email":"josh@junon.me"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/chalk-template_0.3.1_1642483665178_0.6400152724320296"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-01-18T05:27:51.172Z","publish_time":1642483665804,"_cnpm_publish_time":1642483665804},"0.3.0":{"name":"chalk-template","version":"0.3.0","description":"Terminal string styling with tagged template literals","license":"MIT","repository":{"type":"git","url":"git+https://github.com/chalk/chalk-template.git"},"funding":"https://github.com/chalk/chalk-template?sponsor=1","type":"module","exports":"./index.js","engines":{"node":">=12"},"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 && tsd"},"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"],"dependencies":{"chalk":"^4.1.2"},"devDependencies":{"ava":"^3.15.0","cross-env":"^7.0.3","tsd":"^0.18.0","xo":"^0.45.0"},"types":"./index.d.ts","gitHead":"6e63a466ba254b779587b0ca0ad5570588a4c238","bugs":{"url":"https://github.com/chalk/chalk-template/issues"},"homepage":"https://github.com/chalk/chalk-template#readme","_id":"chalk-template@0.3.0","_nodeVersion":"17.3.1","_npmVersion":"8.3.0","dist":{"shasum":"e4af3335250652d50e95a5e45e2880e12ed44523","size":3821,"noattachment":false,"key":"/chalk-template/-/chalk-template-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/chalk-template/download/chalk-template-0.3.0.tgz"},"_npmUser":{"name":"qix","email":"josh@junon.me"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/chalk-template_0.3.0_1642441899648_0.8906032059005411"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-01-17T18:01:48.226Z","publish_time":1642441899843,"_cnpm_publish_time":1642441899843},"0.2.0":{"name":"chalk-template","version":"0.2.0","description":"Terminal string styling with tagged template literals","license":"MIT","repository":{"type":"git","url":"git+https://github.com/chalk/chalk-template.git"},"funding":"https://github.com/chalk/chalk-template?sponsor=1","type":"module","exports":"./index.js","engines":{"node":">=12"},"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 && tsd"},"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"],"dependencies":{"chalk":"^4.1.2"},"devDependencies":{"ava":"^3.15.0","cross-env":"^7.0.3","tsd":"^0.18.0","xo":"^0.45.0"},"types":"./index.d.ts","gitHead":"de9c675bc4f12753c800ad32337c947505709d3b","bugs":{"url":"https://github.com/chalk/chalk-template/issues"},"homepage":"https://github.com/chalk/chalk-template#readme","_id":"chalk-template@0.2.0","_nodeVersion":"12.22.1","_npmVersion":"8.1.0","dist":{"shasum":"b8da6cc36cf4f868318b9bc7f93c075df144cd72","size":3599,"noattachment":false,"key":"/chalk-template/-/chalk-template-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/chalk-template/download/chalk-template-0.2.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/chalk-template_0.2.0_1636022891923_0.18720816450167255"},"_hasShrinkwrap":false,"publish_time":1636022892060,"_cnpm_publish_time":1636022892060,"_cnpmcore_publish_time":"2021-12-17T02:01:49.609Z"},"0.1.0":{"name":"chalk-template","version":"0.1.0","description":"> Simple and easy to use template engine for chalk","email":"simon.mollweide@web.de","author":{"name":"Simon Mollweide","email":"simon.mollweide@web.de"},"url":"https://github.com/smollweide/chalk-template","repository":{"type":"github","url":"git+https://github.com/smollweide/chalk-template.git"},"main":"chalk-template.js","bugs":{"url":"https://github.com/smollweide/chalk-template/issues"},"preferGlobal":false,"private":false,"license":"MIT","homepage":"http://smollweide.github.io/chalk-template/","scripts":{"test":"mocha test.js","lint":"npm run lint:js","lint:js":"eslint **/*.js"},"engines":{"node":">= 4"},"keywords":["cli-app","cli","color","colour","colors","terminal","console","string","str","ansi","style","styles","tty","formatting","rgb","256","shell","xterm","log","logging","command-line","text","template","tpl"],"devDependencies":{"mocha":"3.2.0"},"dependencies":{"@namics/eslint-config":"2.1.0","chalk":"1.1.3","eslint":"3.13.1","eslint-plugin-import":"2.2.0","for-in":"0.1.6"},"gitHead":"57e5adf37156dec31071a3a2668f18759d479971","_id":"chalk-template@0.1.0","_shasum":"2fa1f45469817ff01d66991f86545041f7c2fbf0","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.6.2","_npmUser":{"name":"smollweide","email":"simon.mollweide@web.de"},"dist":{"shasum":"2fa1f45469817ff01d66991f86545041f7c2fbf0","size":3114,"noattachment":false,"key":"/chalk-template/-/chalk-template-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/chalk-template/download/chalk-template-0.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/chalk-template-0.1.0.tgz_1484862008188_0.04853851138614118"},"directories":{},"publish_time":1484862009895,"_hasShrinkwrap":false,"_cnpm_publish_time":1484862009895,"_cnpmcore_publish_time":"2021-12-17T02:01:49.852Z"}},"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","_attachments":{},"homepage":"https://github.com/chalk/chalk-template#readme","bugs":{"url":"https://github.com/chalk/chalk-template/issues"},"license":"MIT"}