{"name":"kleur","version":"4.1.1","repository":{"type":"git","url":"git+https://github.com/lukeed/kleur.git"},"description":"The fastest Node.js library for formatting terminal text with ANSI colors~!","module":"index.mjs","types":"index.d.ts","main":"index.js","license":"MIT","exports":{".":{"import":"./index.mjs","require":"./index.js"},"./colors":{"import":"./colors.mjs","require":"./colors.js"}},"author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"scripts":{"build":"node build","test":"uvu -r esm -i utils -i xyz"},"engines":{"node":">=6"},"keywords":["ansi","cli","color","colors","console","terminal"],"devDependencies":{"esm":"3.2.25","uvu":"0.0.16"},"gitHead":"b08ad63ca21b9f28100c1d4c9517a77009fddd0c","bugs":{"url":"https://github.com/lukeed/kleur/issues"},"homepage":"https://github.com/lukeed/kleur#readme","_id":"kleur@4.1.1","_nodeVersion":"12.18.3","_npmVersion":"6.14.6","dist":{"integrity":"sha512-BsNhM6T/yTWFG580CRnYhT3LfUuPK7Hwrm+W2H0G8lK/nogalP5Nsrh/cHjxVVkzl0sFm7z8b8rNcZCfKxeoxA==","shasum":"80b49dd7d1afeba41b8dcdf4ecfff9252205fc52","tarball":"http://registry-npm.ywwl.com/kleur/download/kleur-4.1.1.tgz","fileCount":9,"unpackedSize":20052,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfPL+/CRA9TVsSAnZWagAAXGkP/RzmmcDGzBTGmgS+DjED\n++irfjwD4ZWJmB+b1P5ZLx45xFq9uHj6nc5Rpg4Xf6oQ5JAbCDvE960SnaYH\nsYNFkBlaOxZdraPprst8z8ephy13x0bDQd/7V41hnv9FW77lPx24/Mr+jrG/\nb/f9FuSmHpyhkM+88cHlk+xXH0nBUxq273af02a75lvbbTnwrTsAaX8ZuPdR\nG1OkN6e/tBspEjQ6maVmRVTqAIsLhDuLfvQW5QQe82euXfhe4QS1m9Szq4WO\nbwEHOaRjSjokjHddT0r39bjmuaSNU+2yIY5lXqalI1cNvsqkcwN3mt92luPY\nV7bYFhiEWcDzmGKbGwXruLUgC9M7j+IWGq5Kb9bMIFBpDOEPPMEiv+UPfNWn\nQZYiu82S1pcTcKxyqWgIsFE2aoFEm6wiQ0NYgSmyq8yY1GvkfcB4hxODLYCX\n4iiDgv5Nq+ZuVmVh8kxwigaK7g2yv9O6KcEEOZnX7BlUZqwYVZjrme0S2e7z\nn6+p38kqyRUyS790q7PpRdpgSaomtY3fAWsEfwGqSAn9N2Qb3t1kDbTZIesf\ncGI9k/JQVDbiU4Q/H26/2Z8S0X8a4P+VEBu3lNLTJdBUnGT/+EQ+Y2xb5P1m\nV2qNUUeegyAuwu5ehs0xtISn7vG5iuePAhsTqXjH3aYsyVsIjFXAAPHTQnoC\nVgMQ\r\n=07nM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD1YTlNef437MRsmHHkJQ93n3yq2di6IN/lbOoZgJHAQgIgWzeH62jJeqTwCAEtFVMCmOXsNQKePL9/cc9ttVZViV0="}],"size":6166,"noattachment":false,"key":"/kleur/-/kleur-4.1.1.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/kleur_4.1.1_1597816767456_0.6956323849939232"},"_hasShrinkwrap":false,"readme":"<div align=\"center\">\n  <img src=\"shots/logo.png\" alt=\"kleur\" height=\"120\" />\n</div>\n\n<div align=\"center\">\n  <a href=\"https://npmjs.org/package/kleur\">\n    <img src=\"https://badgen.now.sh/npm/v/kleur\" alt=\"version\" />\n  </a>\n  <a href=\"https://github.com/lukeed/kleur/actions?query=workflow%3ACI\">\n    <img src=\"https://github.com/lukeed/kleur/workflows/CI/badge.svg?event=push\" alt=\"CI\" />\n  </a>\n  <a href=\"https://npmjs.org/package/kleur\">\n    <img src=\"https://badgen.now.sh/npm/dm/kleur\" alt=\"downloads\" />\n  </a>\n  <a href=\"https://packagephobia.now.sh/result?p=kleur\">\n    <img src=\"https://packagephobia.now.sh/badge?p=kleur\" alt=\"install size\" />\n  </a>\n</div>\n\n<div align=\"center\">The fastest Node.js library for formatting terminal text with ANSI colors~!</div>\n\n## Features\n\n* No dependencies\n* Super [lightweight](#load-time) & [performant](#performance)\n* Supports [nested](#nested-methods) & [chained](#chained-methods) colors\n* No `String.prototype` modifications\n* Conditional [color support](#conditional-support)\n* [Fully treeshakable](#individual-colors)\n* Familiar [API](#api)\n\n---\n\nAs of `v3.0` the Chalk-style syntax (magical getter) is no longer used.<br>Please visit [History](#history) for migration paths supporting that syntax.\n\n---\n\n\n## Install\n\n```\n$ npm install --save kleur\n```\n\n\n## Usage\n\n```js\nimport kleur from 'kleur';\n\n// basic usage\nkleur.red('red text');\n\n// chained methods\nkleur.blue().bold().underline('howdy partner');\n\n// nested methods\nkleur.bold(`${ white().bgRed('[ERROR]') } ${ kleur.red().italic('Something happened')}`);\n```\n\n### Chained Methods\n\n```js\nconst { bold, green } = require('kleur');\n\nconsole.log(bold().red('this is a bold red message'));\nconsole.log(bold().italic('this is a bold italicized message'));\nconsole.log(bold().yellow().bgRed().italic('this is a bold yellow italicized message'));\nconsole.log(green().bold().underline('this is a bold green underlined message'));\n```\n\n<img src=\"shots/1.png\" width=\"300\" />\n\n### Nested Methods\n\n```js\nconst { yellow, red, cyan } = require('kleur');\n\nconsole.log(yellow(`foo ${red().bold('red')} bar ${cyan('cyan')} baz`));\nconsole.log(yellow('foo ' + red().bold('red') + ' bar ' + cyan('cyan') + ' baz'));\n```\n\n<img src=\"shots/2.png\" width=\"300\" />\n\n\n### Conditional Support\n\nToggle color support as needed; `kleur` includes simple auto-detection which may not cover all cases.\n\n> **Note:** Both `kleur` and `kleur/colors` share the same detection logic.\n\n```js\nimport kleur from 'kleur';\n\n// manually disable\nkleur.enabled = false;\n\n// or use another library to detect support\nkleur.enabled = require('color-support').level > 0;\n\nconsole.log(kleur.red('I will only be colored red if the terminal supports colors'));\n```\n\n> **Important:** <br>Colors will be disabled automatically in non [TTY contexts](https://nodejs.org/api/process.html#process_a_note_on_process_i_o). For example, spawning another process or piping output into another process will disable colorization automatically. To force colors in your piped output, you may do so with the `FORCE_COLOR=1` environment variable:\n\n```sh\n$ node app.js #=> COLORS\n$ node app.js > log.txt  #=> NO COLORS\n$ FORCE_COLOR=1 node app.js > log.txt #=> COLORS\n$ FORCE_COLOR=0 node app.js > log.txt #=> NO COLORS\n```\n\n## API\n\nAny `kleur` method returns a `String` when invoked with input; otherwise chaining is expected.\n\n> It's up to the developer to pass the output to destinations like `console.log`, `process.stdout.write`, etc.\n\nThe methods below are grouped by type for legibility purposes only. They each can be [chained](#chained-methods) or [nested](#nested-methods) with one another.\n\n***Colors:***\n> black &mdash; red &mdash; green &mdash; yellow &mdash; blue &mdash; magenta &mdash; cyan &mdash; white &mdash; gray &mdash; grey\n\n***Backgrounds:***\n> bgBlack &mdash; bgRed &mdash; bgGreen &mdash; bgYellow &mdash; bgBlue &mdash; bgMagenta &mdash; bgCyan &mdash; bgWhite\n\n***Modifiers:***\n> reset &mdash; bold &mdash; dim &mdash; italic* &mdash; underline &mdash; inverse &mdash; hidden &mdash; strikethrough*\n\n<sup>* <em>Not widely supported</em></sup>\n\n\n## Individual Colors\n\nWhen you only need a few colors, it doesn't make sense to import _all_ of `kleur` because, as small as it is, `kleur` is not treeshakeable, and so most of its code will be doing nothing. In order to fix this, you can import from the `kleur/colors` submodule which _fully_ supports tree-shaking.\n\nThe caveat with this approach is that color functions **are not** chainable~!<br>Each function receives and colorizes its input. You may combine colors, backgrounds, and modifiers by nesting function calls within other functions.\n\n```js\n// or: import * as kleur from 'kleur/colors';\nimport { red, underline, bgWhite } from 'kleur/colors';\n\nred('red text');\n//~> kleur.red('red text');\n\nunderline(red('red underlined text'));\n//~> kleur.underline().red('red underlined text');\n\nbgWhite(underline(red('red underlined text w/ white background')));\n//~> kleur.bgWhite().underline().red('red underlined text w/ white background');\n```\n\n> **Note:** All the same [colors, backgrounds, and modifiers](#api) are available.\n\n***Conditional Support***\n\nThe `kleur/colors` submodule also allows you to toggle color support, as needed.<br>\nIt includes the same initial assumptions as `kleur`, in an attempt to have colors enabled by default.\n\nUnlike `kleur`, this setting exists as `kleur.$.enabled` instead of `kleur.enabled`:\n\n```js\nimport * as kleur from 'kleur/colors';\n// or: import { $, red } from 'kleur/colors';\n\n// manually disabled\nkleur.$.enabled = false;\n\n// or use another library to detect support\nkleur.$.enabled = require('color-support').level > 0;\n\nconsole.log(red('I will only be colored red if the terminal supports colors'));\n```\n\n\n## Benchmarks\n\n> Using Node v10.13.0\n\n### Load time\n\n```\nchalk        :: 5.303ms\nkleur        :: 0.488ms\nkleur/colors :: 0.369ms\nansi-colors  :: 1.504ms\n```\n\n### Performance\n\n```\n# All Colors\n  ansi-colors      x 177,625 ops/sec ±1.47% (92 runs sampled)\n  chalk            x 611,907 ops/sec ±0.20% (92 runs sampled)\n  kleur            x 742,509 ops/sec ±1.47% (93 runs sampled)\n  kleur/colors     x 881,742 ops/sec ±0.19% (98 runs sampled)\n\n# Stacked colors\n  ansi-colors      x  23,331 ops/sec ±1.81% (94 runs sampled)\n  chalk            x 337,178 ops/sec ±0.20% (98 runs sampled)\n  kleur            x  78,299 ops/sec ±1.01% (97 runs sampled)\n  kleur/colors     x 104,431 ops/sec ±0.22% (97 runs sampled)\n\n# Nested colors\n  ansi-colors      x  67,181 ops/sec ±1.15% (92 runs sampled)\n  chalk            x 116,361 ops/sec ±0.63% (94 runs sampled)\n  kleur            x 139,514 ops/sec ±0.76% (95 runs sampled)\n  kleur/colors     x 145,716 ops/sec ±0.97% (97 runs sampled)\n```\n\n\n## History\n\nThis project originally forked [`ansi-colors`](https://github.com/doowb/ansi-colors).\n\nBeginning with `kleur@3.0`, the Chalk-style syntax (magical getter) has been replaced with function calls per key:\n\n```js\n// Old:\nc.red.bold.underline('old');\n\n// New:\nc.red().bold().underline('new');\n```\n> <sup><em>As I work more with Rust, the newer syntax feels so much better & more natural!</em></sup>\n\nIf you prefer the old syntax, you may migrate to `ansi-colors` or newer `chalk` releases.<br>Versions below `kleur@3.0` have been officially deprecated.\n\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","publish_time":1597816767607,"_cnpm_publish_time":1597816767607,"dist-tags":{"latest":"4.1.5"}}