{"name":"kleur","version":"4.1.0","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","main":"index.js","types":"kleur.d.ts","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":"609312459c14e59d02664ede01be71b4a7276a65","bugs":{"url":"https://github.com/lukeed/kleur/issues"},"homepage":"https://github.com/lukeed/kleur#readme","_id":"kleur@4.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"integrity":"sha512-s9jD+1dPhJVOzEAGjuabDC1NJdNr1UGj84SftcGukJDpQaLbwuJTakb7FqAhm4cFkhaIvS2DV092FXMyUgPt+w==","shasum":"eea37aa8c210a06c42a591ee56a13f137a13add3","tarball":"http://registry-npm.ywwl.com/kleur/download/kleur-4.1.0.tgz","fileCount":8,"unpackedSize":19772,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfNK1OCRA9TVsSAnZWagAAoIUP/iO42ALgqm5kxIKbtJNQ\nG4EYrQfqFzdz6dg8TlutSlojaYgB5YbpMHSF+NNqBeGUhV2k5noqwMhzEsmi\ngRXajOuPhKPM5ZlRh7L+qU9eviWB7FMRSQXfnf/OdgKkPlwkXJryTLvqhrgp\noDoLoo3MV2SVw4yaZTVmeSfGHAw+4Yq30z8ijzQugUEWVSTFv+jI40Ou2SDP\nRk0C7Dt2LJDweqg6xak7hlfjN9W7vHtKZtLFjht9RBwRKKJfFqv/3RZ2tfjw\nWEwRY3UL3gad0vCibWnw3N7hHxGW2bIlCCTJbIzs2jDhsYMQXL3pTXGX67l3\nErv5SpYlI865EgYprP0Kjdta9G0K0HMNziE5OHlSQ8qzZXauzUps7ywKNDF2\nls5hJgRL6zAypjsqtYhy9h6kK+lq+rVnGaDsYcakJF8iWB0BYGfvDhVlFwI7\nR0IwSHCiOi3kAiiBtso5CSL6Xbqs/D4C6xnjmesascN4NSg2k/d/NS+pbaIR\nAg0ObzKGfg0lYTHGNmQVK9PQyfwcsC0JgL894kiRxZbkGAzN7HOoViek8dS+\nKxuaxNjnVI4CL39cJwwIdYYz2ODH6NyUsh3LQai9TgxKtdZ0+PLqwQiHrOKg\n8ExqXp08QrJyGKdSxQwXfkqIdymJAXE0RtkI1WlrjlngSeK4HSgs/PVqoX6E\nffjf\r\n=of/V\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFKx+esAsIl5PMke3yL/G3cln9d9c10+udPaEeN85X6oAiEArOrI7QYciOiv2ss6KyKHbMekArb5zLivjZHfAQO5NcE="}],"size":6108,"noattachment":false,"key":"/kleur/-/kleur-4.1.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/kleur_4.1.0_1597287757400_0.22475606815782823"},"_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":1597287757572,"_cnpm_publish_time":1597287757572,"dist-tags":{"latest":"4.1.5"}}