{"name":"kleur","version":"3.0.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~!","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"lukeed.com"},"scripts":{"test":"tape test/*.js | tap-spec"},"engines":{"node":">=6"},"keywords":["ansi","cli","color","colors","console","terminal"],"types":"kleur.d.ts","devDependencies":{"tap-spec":"^5.0.0","tape":"^4.9.1"},"gitHead":"59d7d74f461a338141f3bd16ea21d8d1f814d367","bugs":{"url":"https://github.com/lukeed/kleur/issues"},"homepage":"https://github.com/lukeed/kleur#readme","_id":"kleur@3.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"integrity":"sha512-P3kRv+B+Ra070ng2VKQqW4qW7gd/v3iD8sy/zOdcYRsfiD+QBokQNOps/AfP6Hr48cBhIIBFWckB9aO+IZhrWg==","shasum":"4f5b313f5fa315432a400f19a24db78d451ede62","tarball":"http://registry-npm.ywwl.com/kleur/download/kleur-3.0.1.tgz","fileCount":5,"unpackedSize":9752,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcCsmrCRA9TVsSAnZWagAA3AAP/iPIIMcBRXCA8aDFfRFL\n0zy74H+CkH7qQXuEsxD46Ck/SRuCoIONnFby50FSwHl2qM4RKKXQx64CZC43\n15fsjelWp/0F313sH0J6SoeqQgVd8+6A0SaK1ZOA0hp+ScmDGl878NBtoAGC\n75xsQYckTD6AE+6YTpXZuVfiiodfQThWrQXgXm8GVlfRRiT64FCsdtiR3cJ2\nfproMnU/BX4dvzPY/KyFeKbStq/XD5gyTpIXnnDaibdmgtzD+qzc9pfGksXy\n6voMZmPX+rFFfg49TUpUXRjgo9ior/06BzNyMMDw5daaE8f1j33brzXyWn9Q\nj+y/4bna7FUCDZmcN0YbiQ/YSMxgCxxC6B/z+G/Sw9my6r7zZ8HSvIJLUvqJ\nNOynp4mB1qIzsN0l4plS7z+Ku2aHYHL5yEtLufolJnCL/MVBOr7XKQeMKb+B\nwVg5brERPUdjfPuLw5X0XmHzHsO/VXseroT6985fvSS+EHIy+bJmFbaTyxo2\n4d2uWdMeeohnxQ0JMWBzeO6eIJI4xe0ZmRpKVOOF6WHh0F8OMozvXVy6pRlV\n5wVDUsMVjaPdNbEU/uWJ2gWppqnG6cXG/5cHJUnZPqMcV8vVf3inoDu4Lzt4\nOXPFiWUDb35yvwyzCgcs3zbSvG2Ye9NwQi+eMKk2YxO2gNoaKXuTH1IaTvNm\n6zIq\r\n=8/oe\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDKQZGw+HalYNDDA4uBwkgGZwQao/drWOsCDzEb3yx8NgIgVxo1Sy1w6UvfWQq5RfHWCUXr1NRxN6wLjzmoV0B4D9w="}],"size":4296,"noattachment":false,"key":"/kleur/-/kleur-3.0.1.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/kleur_3.0.1_1544210858263_0.6552051127407896"},"_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":1544210858402,"_cnpm_publish_time":1544210858402,"dist-tags":{"latest":"4.1.5"}}