{"_id":"yoctocolors-cjs","_rev":"4122743","name":"yoctocolors-cjs","description":"CommonJS version - The smallest and fastest command-line coloring package on the internet","dist-tags":{"latest":"2.1.3"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2026-02-24T19:25:56.000Z","created":"2024-06-29T19:37:21.705Z","2.1.3":"2025-08-21T08:24:47.792Z","2.1.2":"2024-07-03T23:19:11.886Z","2.1.1":"2024-06-29T19:50:58.841Z","2.1.0":"2024-06-29T19:37:21.705Z"},"users":{},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/yoctocolors.git"},"versions":{"2.1.3":{"name":"yoctocolors-cjs","version":"2.1.3","description":"CommonJS version - The smallest and fastest command-line coloring package on the internet","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/yoctocolors.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"commonjs","main":"./index.js","types":"./index.d.ts","sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsd"},"keywords":["color","colour","colors","terminal","console","cli","string","ansi","style","styles","tty","formatting","shell","xterm","log","logging","command-line","text"],"devDependencies":{"@jonahsnider/benchmark":"^5.0.3","ansi-colors":"^4.1.3","ava":"^6.1.3","chalk":"^5.3.0","cli-color":"^2.0.4","colorette":"^2.0.20","kleur":"^4.1.5","nanocolors":"^0.2.13","picocolors":"^1.0.1","tsd":"^0.31.0","xo":"^0.58.0"},"ava":{"environmentVariables":{"FORCE_COLOR":"1"}},"_id":"yoctocolors-cjs@2.1.3","gitHead":"156ae5626c7a47bff6c976cc48535f2e37571a63","bugs":{"url":"https://github.com/sindresorhus/yoctocolors/issues"},"homepage":"https://github.com/sindresorhus/yoctocolors#readme","_nodeVersion":"20.19.1","_npmVersion":"10.9.2","dist":{"shasum":"7e4964ea8ec422b7a40ac917d3a344cfd2304baa","size":4092,"noattachment":false,"key":"/yoctocolors-cjs/-/yoctocolors-cjs-2.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/yoctocolors-cjs/download/yoctocolors-cjs-2.1.3.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/yoctocolors-cjs_2.1.3_1755764687577_0.4998247959117035"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-08-21T08:24:47.792Z","publish_time":1755764687792,"_source_registry_name":"default","_cnpm_publish_time":1755764687792},"2.1.2":{"name":"yoctocolors-cjs","version":"2.1.2","description":"CommonJS version - The smallest and fastest command-line coloring package on the internet","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/yoctocolors.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"commonjs","main":"./index.js","types":"./index.d.ts","sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsd"},"keywords":["color","colour","colors","terminal","console","cli","string","ansi","style","styles","tty","formatting","shell","xterm","log","logging","command-line","text"],"devDependencies":{"@jonahsnider/benchmark":"^5.0.3","ansi-colors":"^4.1.3","ava":"^6.1.3","chalk":"^5.3.0","cli-color":"^2.0.4","colorette":"^2.0.20","kleur":"^4.1.5","nanocolors":"^0.2.13","picocolors":"^1.0.1","tsd":"^0.31.0","xo":"^0.58.0"},"ava":{"environmentVariables":{"FORCE_COLOR":"1"}},"_id":"yoctocolors-cjs@2.1.2","gitHead":"894db35811c39683a727d86857816b1b1f874d73","bugs":{"url":"https://github.com/sindresorhus/yoctocolors/issues"},"homepage":"https://github.com/sindresorhus/yoctocolors#readme","_nodeVersion":"18.20.2","_npmVersion":"10.6.0","dist":{"shasum":"f4b905a840a37506813a7acaa28febe97767a242","size":3955,"noattachment":false,"key":"/yoctocolors-cjs/-/yoctocolors-cjs-2.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/yoctocolors-cjs/download/yoctocolors-cjs-2.1.2.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/yoctocolors-cjs_2.1.2_1720048751712_0.1901768766143055"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-07-03T23:19:11.886Z","publish_time":1720048751886,"_source_registry_name":"default","_cnpm_publish_time":1720048751886},"2.1.1":{"name":"yoctocolors-cjs","version":"2.1.1","description":"CommonJS version - The smallest and fastest command-line coloring package on the internet","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/yoctocolors.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"commonjs","main":"./index.js","types":"./index.d.ts","sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsd"},"keywords":["color","colour","colors","terminal","console","cli","string","ansi","style","styles","tty","formatting","shell","xterm","log","logging","command-line","text"],"devDependencies":{"@jonahsnider/benchmark":"^5.0.3","ansi-colors":"^4.1.3","ava":"^6.1.3","chalk":"^5.3.0","cli-color":"^2.0.4","colorette":"^2.0.20","kleur":"^4.1.5","nanocolors":"^0.2.13","picocolors":"^1.0.1","tsd":"^0.31.0","xo":"^0.58.0"},"ava":{"environmentVariables":{"FORCE_COLOR":"1"}},"_id":"yoctocolors-cjs@2.1.1","gitHead":"061aa1b9b6907f87b1b0d7f5a0efd60cf8f7ab46","bugs":{"url":"https://github.com/sindresorhus/yoctocolors/issues"},"homepage":"https://github.com/sindresorhus/yoctocolors#readme","_nodeVersion":"18.20.2","_npmVersion":"10.6.0","dist":{"shasum":"1a096cffaeda2eb725e33b19735681875465c920","size":3920,"noattachment":false,"key":"/yoctocolors-cjs/-/yoctocolors-cjs-2.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/yoctocolors-cjs/download/yoctocolors-cjs-2.1.1.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/yoctocolors-cjs_2.1.1_1719690658681_0.6942502708904801"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-06-29T19:50:58.841Z","publish_time":1719690658841,"_source_registry_name":"default","maintainers":[{"name":"sindresorhus","email":""}],"_cnpm_publish_time":1719690658841},"2.1.0":{"name":"yoctocolors-cjs","version":"2.1.0","description":"CommonJS version - The smallest and fastest command-line coloring package on the internet","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/yoctocolors.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"commonjs","main":"./index.js","types":"./index.d.ts","sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsd"},"keywords":["color","colour","colors","terminal","console","cli","string","ansi","style","styles","tty","formatting","shell","xterm","log","logging","command-line","text"],"devDependencies":{"@jonahsnider/benchmark":"^5.0.3","ansi-colors":"^4.1.3","ava":"^6.1.3","chalk":"^5.3.0","cli-color":"^2.0.4","colorette":"^2.0.20","kleur":"^4.1.5","nanocolors":"^0.2.13","picocolors":"^1.0.1","tsd":"^0.31.0","xo":"^0.58.0"},"ava":{"environmentVariables":{"FORCE_COLOR":"1"}},"_id":"yoctocolors-cjs@2.1.0","gitHead":"ba8bfa76bb8b9013d8b4cf6832ac6847e53057dd","bugs":{"url":"https://github.com/sindresorhus/yoctocolors/issues"},"homepage":"https://github.com/sindresorhus/yoctocolors#readme","_nodeVersion":"18.20.2","_npmVersion":"10.6.0","dist":{"shasum":"93ffbd28405d9f412792bcda4dc6145ec3029b9f","size":4047,"noattachment":false,"key":"/yoctocolors-cjs/-/yoctocolors-cjs-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/yoctocolors-cjs/download/yoctocolors-cjs-2.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/yoctocolors-cjs_2.1.0_1719689841518_0.2251624956490117"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-06-29T19:37:21.705Z","publish_time":1719689841705,"_source_registry_name":"default","maintainers":[{"name":"sindresorhus","email":""}],"_cnpm_publish_time":1719689841705}},"readme":"<sup>yoctocolors ????</sup>\n\n> The smallest and fastest command-line coloring package on the internet\n\n*Check out [Chalk](https://github.com/chalk/chalk) if you want something more mature and comprehensive.*\n\n## Highlights\n\n- Tiny\n- Fast\n- Handles nested colors\n- Tree-shakeable\n- No dependencies\n- Actively maintained\n\n## Install\n\n```sh\nnpm install yoctocolors\n```\n\n## Usage\n\n```js\nimport colors from 'yoctocolors';\n\nconsole.log(colors.red('Yo!'));\n\nconsole.log(colors.blue(`Welcome to the ${colors.green('yoctocolors')} package!`));\n```\n\nYou can also import colors as named imports:\n\n```js\nimport {red, blue, green} from 'yoctocolors';\n\nconsole.log(red('Yo!'));\n\nconsole.log(blue(`Welcome to the ${green('yoctocolors')} package!`));\n```\n\n*This package supports [basic color detection](https://nodejs.org/api/tty.html#writestreamhascolorscount-env). Colors can be forcefully enabled by setting the `FORCE_COLOR` environment variable to `1` and can be forcefully disabled by setting `NO_COLOR` or `NODE_DISABLE_COLORS` to any value. [More info.](https://nodejs.org/api/tty.html#writestreamgetcolordepthenv)*\n\n## Styles\n\n### Modifiers\n\n- `reset` - Reset the current style.\n- `bold` - Make the text bold.\n- `dim` - Make the text have lower opacity.\n- `italic` - Make the text italic. *(Not widely supported)*\n- `underline` - Put a horizontal line above the text. *(Not widely supported)*\n- `overline` - Put a horizontal line below the text. *(Not widely supported)*\n- `inverse`- Invert background and foreground colors.\n- `hidden` - Print the text but make it invisible.\n- `strikethrough` - Put a horizontal line through the center of the text. *(Not widely supported)*\n\n### Colors\n\n- `black`\n- `red`\n- `green`\n- `yellow`\n- `blue`\n- `magenta`\n- `cyan`\n- `white`\n- `gray`\n- `redBright`\n- `greenBright`\n- `yellowBright`\n- `blueBright`\n- `magentaBright`\n- `cyanBright`\n- `whiteBright`\n\n### Background colors\n\n- `bgBlack`\n- `bgRed`\n- `bgGreen`\n- `bgYellow`\n- `bgBlue`\n- `bgMagenta`\n- `bgCyan`\n- `bgWhite`\n- `bgGray`\n- `bgRedBright`\n- `bgGreenBright`\n- `bgYellowBright`\n- `bgBlueBright`\n- `bgMagentaBright`\n- `bgCyanBright`\n- `bgWhiteBright`\n\n## Prior art\n\nYes\n\n## Benchmark\n\n```sh\n$ ./benchmark.js\n┌─────────┬────────────────┬─────────────┐\n│ (index) │ library        │ ops/sec     │\n├─────────┼────────────────┼─────────────┤\n│ 0       │ 'yoctocolors'  │ '8,000,000' │\n│ 1       │ 'colorette'    │ '8,000,000' │\n│ 2       │ 'picocolors'   │ '8,000,000' │\n│ 3       │ 'nanocolors'   │ '5,988,024' │\n│ 4       │ 'chalk'        │ '4,807,692' │\n│ 5       │ 'kleur/colors' │ '4,807,692' │\n│ 6       │ 'kleur'        │ '4,784,689' │\n│ 7       │ 'ansi-colors'  │ '2,178,649' │\n│ 8       │ 'cli-color'    │ '585,138'   │\n└─────────┴────────────────┴─────────────┘\n```\n\n*See [benchmark.js](benchmark.js).*\n\n## FAQ\n\n### What is yocto?\n\n[It was the smallest official unit prefix in the metric system until 2022.](https://en.wikipedia.org/wiki/Yocto-) Much smaller than nano.\n\n## Related\n\n- [yoctodelay](https://github.com/sindresorhus/yoctodelay) - Delay a promise a given amount of time\n- [chalk](https://github.com/chalk/chalk) - Terminal string styling\n","_attachments":{},"homepage":"https://github.com/sindresorhus/yoctocolors#readme","bugs":{"url":"https://github.com/sindresorhus/yoctocolors/issues"},"license":"MIT"}