{"_id":"@colors/colors","_rev":"2996289","name":"@colors/colors","description":"get colors in your node.js console","dist-tags":{"latest":"1.6.0"},"maintainers":[{"name":"dabh","email":"dabh@stanford.edu"}],"time":{"modified":"2023-08-28T09:22:42.000Z","created":"2022-02-12T06:40:43.730Z","1.6.0":"2023-07-10T05:16:15.097Z","1.5.0":"2022-02-12T07:39:04.960Z","1.4.0":"2022-02-12T06:40:43.730Z"},"users":{},"author":{"name":"DABH"},"repository":{"type":"git","url":"git+ssh://git@github.com/DABH/colors.js.git"},"versions":{"1.6.0":{"name":"@colors/colors","description":"get colors in your node.js console","version":"1.6.0","author":{"name":"DABH"},"contributors":[{"name":"DABH","url":"https://github.com/DABH"}],"homepage":"https://github.com/DABH/colors.js","bugs":{"url":"https://github.com/DABH/colors.js/issues"},"keywords":["ansi","terminal","colors"],"repository":{"type":"git","url":"git+ssh://git@github.com/DABH/colors.js.git"},"license":"MIT","scripts":{"lint":"eslint . --fix","test":"export FORCE_COLOR=1 && node tests/basic-test.js && node tests/safe-test.js"},"engines":{"node":">=0.1.90"},"main":"lib/index.js","devDependencies":{"eslint":"^8.9.0","eslint-config-google":"^0.14.0"},"_id":"@colors/colors@1.6.0","gitHead":"c7a1adaff5f3a865932b4525cb6f3a5903e6fc67","_nodeVersion":"16.18.0","_npmVersion":"9.8.0","dist":{"shasum":"ec6cd237440700bc23ca23087f513c75508958b0","size":11365,"noattachment":false,"key":"/@colors/colors/-/@colors/colors-1.6.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@colors/colors/download/@colors/colors-1.6.0.tgz"},"_npmUser":{"name":"dabh","email":"dabh@alumni.stanford.edu"},"directories":{},"maintainers":[{"name":"dabh","email":"dabh@stanford.edu"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/colors_1.6.0_1688966174864_0.4886941842666821"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-07-10T05:16:15.097Z","publish_time":1688966175097,"_source_registry_name":"default","_cnpm_publish_time":1688966175097},"1.5.0":{"name":"@colors/colors","description":"get colors in your node.js console","version":"1.5.0","author":{"name":"DABH"},"contributors":[{"name":"DABH","url":"https://github.com/DABH"}],"homepage":"https://github.com/DABH/colors.js","bugs":{"url":"https://github.com/DABH/colors.js/issues"},"keywords":["ansi","terminal","colors"],"repository":{"type":"git","url":"git+ssh://git@github.com/DABH/colors.js.git"},"license":"MIT","scripts":{"lint":"eslint . --fix","test":"export FORCE_COLOR=1 && node tests/basic-test.js && node tests/safe-test.js"},"engines":{"node":">=0.1.90"},"main":"lib/index.js","devDependencies":{"eslint":"^5.2.0","eslint-config-google":"^0.11.0"},"gitHead":"945ea7927adda453b7f4cfa447967dc7aac1b53b","_id":"@colors/colors@1.5.0","_nodeVersion":"14.16.1","_npmVersion":"8.4.1","dist":{"shasum":"bb504579c1cae923e6576a4f5da43d25f97bdbd9","size":11152,"noattachment":false,"key":"/@colors/colors/-/@colors/colors-1.5.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@colors/colors/download/@colors/colors-1.5.0.tgz"},"_npmUser":{"name":"dabh","email":"dabh@alumni.stanford.edu"},"directories":{},"maintainers":[{"name":"dabh","email":"dabh@stanford.edu"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/colors_1.5.0_1644651544801_0.4184159985898479"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-02-12T07:39:10.552Z","publish_time":1644651544960,"_cnpm_publish_time":1644651544960},"1.4.0":{"name":"@colors/colors","description":"get colors in your node.js console","version":"1.4.0","author":{"name":"DABH"},"contributors":[{"name":"DABH","url":"https://github.com/DABH"}],"homepage":"https://github.com/DABH/colors.js","bugs":{"url":"https://github.com/DABH/colors.js/issues"},"keywords":["ansi","terminal","colors"],"repository":{"type":"git","url":"git+ssh://git@github.com/DABH/colors.js.git"},"license":"MIT","scripts":{"lint":"eslint . --fix","test":"node tests/basic-test.js && node tests/safe-test.js"},"engines":{"node":">=0.1.90"},"main":"lib/index.js","devDependencies":{"eslint":"^5.2.0","eslint-config-google":"^0.11.0"},"gitHead":"c9e1be4a3fbd49ab31f2c0b531a2c22c2da4af26","_id":"@colors/colors@1.4.0","_nodeVersion":"14.16.1","_npmVersion":"8.4.1","dist":{"shasum":"8f30d81b609b5d422cf5784276a1b1ce8cb5b05c","size":11134,"noattachment":false,"key":"/@colors/colors/-/@colors/colors-1.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@colors/colors/download/@colors/colors-1.4.0.tgz"},"_npmUser":{"name":"dabh","email":"dabh@alumni.stanford.edu"},"directories":{},"maintainers":[{"name":"dabh","email":"dabh@stanford.edu"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/colors_1.4.0_1644648043563_0.8443133290782114"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-02-12T06:40:51.234Z","publish_time":1644648043730,"_cnpm_publish_time":1644648043730}},"readme":"# @colors/colors (\"colors.js\")\n[![Build Status](https://github.com/DABH/colors.js/actions/workflows/ci.yml/badge.svg)](https://github.com/DABH/colors.js/actions/workflows/ci.yml)\n[![version](https://img.shields.io/npm/v/@colors/colors.svg)](https://www.npmjs.org/package/@colors/colors)\n\nPlease check out the [roadmap](ROADMAP.md) for upcoming features and releases.  Please open Issues to provide feedback.\n\n## get color and style in your node.js console\n\n![Demo](https://raw.githubusercontent.com/DABH/colors.js/master/screenshots/colors.png)\n\n## Installation\n\n    npm install @colors/colors\n\n## colors and styles!\n\n### text colors\n\n  - black\n  - red\n  - green\n  - yellow\n  - blue\n  - magenta\n  - cyan\n  - white\n  - gray\n  - grey\n\n### bright text colors\n\n  - brightRed\n  - brightGreen\n  - brightYellow\n  - brightBlue\n  - brightMagenta\n  - brightCyan\n  - brightWhite\n\n### background colors\n\n  - bgBlack\n  - bgRed\n  - bgGreen\n  - bgYellow\n  - bgBlue\n  - bgMagenta\n  - bgCyan\n  - bgWhite\n  - bgGray\n  - bgGrey\n\n### bright background colors\n\n  - bgBrightRed\n  - bgBrightGreen\n  - bgBrightYellow\n  - bgBrightBlue\n  - bgBrightMagenta\n  - bgBrightCyan\n  - bgBrightWhite\n\n### styles\n\n  - reset\n  - bold\n  - dim\n  - italic\n  - underline\n  - inverse\n  - hidden\n  - strikethrough\n\n### extras\n\n  - rainbow\n  - zebra\n  - america\n  - trap\n  - random\n\n\n## Usage\n\nBy popular demand, `@colors/colors` now ships with two types of usages!\n\nThe super nifty way\n\n```js\nvar colors = require('@colors/colors');\n\nconsole.log('hello'.green); // outputs green text\nconsole.log('i like cake and pies'.underline.red); // outputs red underlined text\nconsole.log('inverse the color'.inverse); // inverses the color\nconsole.log('OMG Rainbows!'.rainbow); // rainbow\nconsole.log('Run the trap'.trap); // Drops the bass\n\n```\n\nor a slightly less nifty way which doesn't extend `String.prototype`\n\n```js\nvar colors = require('@colors/colors/safe');\n\nconsole.log(colors.green('hello')); // outputs green text\nconsole.log(colors.red.underline('i like cake and pies')); // outputs red underlined text\nconsole.log(colors.inverse('inverse the color')); // inverses the color\nconsole.log(colors.rainbow('OMG Rainbows!')); // rainbow\nconsole.log(colors.trap('Run the trap')); // Drops the bass\n\n```\n\nI prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way. \n\nIf you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object.\n\n## Enabling/Disabling Colors\n\nThe package will auto-detect whether your terminal can use colors and enable/disable accordingly. When colors are disabled, the color functions do nothing. You can override this with a command-line flag:\n\n```bash\nnode myapp.js --no-color\nnode myapp.js --color=false\n\nnode myapp.js --color\nnode myapp.js --color=true\nnode myapp.js --color=always\n\nFORCE_COLOR=1 node myapp.js\n```\n\nOr in code:\n\n```javascript\nvar colors = require('@colors/colors');\ncolors.enable();\ncolors.disable();\n```\n\n## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)\n\n```js\nvar name = 'Beowulf';\nconsole.log(colors.green('Hello %s'), name);\n// outputs -> 'Hello Beowulf'\n```\n\n## Custom themes\n\n### Using standard API\n\n```js\n\nvar colors = require('@colors/colors');\n\ncolors.setTheme({\n  silly: 'rainbow',\n  input: 'grey',\n  verbose: 'cyan',\n  prompt: 'grey',\n  info: 'green',\n  data: 'grey',\n  help: 'cyan',\n  warn: 'yellow',\n  debug: 'blue',\n  error: 'red'\n});\n\n// outputs red text\nconsole.log(\"this is an error\".error);\n\n// outputs yellow text\nconsole.log(\"this is a warning\".warn);\n```\n\n### Using string safe API\n\n```js\nvar colors = require('@colors/colors/safe');\n\n// set single property\nvar error = colors.red;\nerror('this is red');\n\n// set theme\ncolors.setTheme({\n  silly: 'rainbow',\n  input: 'grey',\n  verbose: 'cyan',\n  prompt: 'grey',\n  info: 'green',\n  data: 'grey',\n  help: 'cyan',\n  warn: 'yellow',\n  debug: 'blue',\n  error: 'red'\n});\n\n// outputs red text\nconsole.log(colors.error(\"this is an error\"));\n\n// outputs yellow text\nconsole.log(colors.warn(\"this is a warning\"));\n\n```\n\n### Combining Colors\n\n```javascript\nvar colors = require('@colors/colors');\n\ncolors.setTheme({\n  custom: ['red', 'underline']\n});\n\nconsole.log('test'.custom);\n```\n\n*Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*\n","_attachments":{},"homepage":"https://github.com/DABH/colors.js","bugs":{"url":"https://github.com/DABH/colors.js/issues"},"license":"MIT"}