{"name":"cli-color","version":"2.0.3","description":"Colors, formatting and other tools for the console","author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"keywords":["ansi","color","console","terminal","cli","shell","log","logging","xterm"],"repository":{"type":"git","url":"git://github.com/medikoo/cli-color.git"},"dependencies":{"d":"^1.0.1","es5-ext":"^0.10.61","es6-iterator":"^2.0.3","memoizee":"^0.4.15","timers-ext":"^0.1.7"},"devDependencies":{"eslint":"^8.19.0","eslint-config-medikoo":"^4.1.2","git-list-updated":"^1.2.1","github-release-from-cc-changelog":"^2.3.0","husky":"^4.3.8","lint-staged":"^13.0.3","nyc":"^15.1.0","prettier-elastic":"^2.2.1","tad":"^3.1.0"},"husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS","pre-commit":"lint-staged"}},"lint-staged":{"*.js":["eslint"],"*.{css,html,js,json,md,yaml,yml}":["prettier -c"]},"eslintConfig":{"extends":"medikoo/node/es5","root":true,"rules":{"id-length":"off"},"overrides":[{"files":"examples/**","rules":{"no-console":"off"}}]},"prettier":{"printWidth":100,"tabWidth":4,"overrides":[{"files":["*.md","*.yml"],"options":{"tabWidth":2}}]},"nyc":{"all":true,"exclude":[".github","coverage/**","examples","test/**","*.config.js"],"reporter":["lcov","html","text-summary"]},"scripts":{"coverage":"nyc npm test","lint":"eslint --ignore-path=.gitignore .","lint:updated":"pipe-git-updated --base=main --ext=js -- eslint --ignore-pattern '!*'","prepare-release":"standard-version && prettier --write CHANGELOG.md","prettier-check":"prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"","prettier-check:updated":"pipe-git-updated --base=main --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c","prettify":"prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"","prettify:updated":"pipe-git-updated --base=main --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier --write","test":"tad"},"engines":{"node":">=0.10"},"license":"ISC","gitHead":"ab3f29fc1893ee6cf11ed175e8c4c0f50f3210f3","bugs":{"url":"https://github.com/medikoo/cli-color/issues"},"homepage":"https://github.com/medikoo/cli-color#readme","_id":"cli-color@2.0.3","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ==","shasum":"73769ba969080629670f3f2ef69a4bf4e7cc1879","tarball":"http://registry-npm.ywwl.com/cli-color/download/cli-color-2.0.3.tgz","fileCount":24,"unpackedSize":39559,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICs5sl4KJGk2OD9N/0kPExk2+LyTPXYJD3uUEz1HnoEDAiEAtvbSpR6vvFTb+EMPvq0Z5lS2Sa4qtuOSoBgDjyrP3xQ="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiwyjvACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqLPBAAgyqcvlJ96EctAMHanzZmbR4n1D32EcQyHi7tAr/fOfDVw2o7\r\nf++be/wKIl59d6l1PxgY1MY3r2u8Agp1O0mdqgqxsQpILt+cOLyA+VTn8Iea\r\nW2otg+jSk0l3bjuqKTFxIKqRgviRt7ZprmJXzruM1AP9KMmJyalsTTBJSzZ4\r\nn0hBH3gK1tMTKB/rwC4sYdZTg4rqNokJpX+p1AfF3ig0pmslRu9O7QJ07S7e\r\npPQj8qLnqdQalNP3bO/aAGHU6XO3lDc9lhB2nafqn9c+UfyobTOkNrUVtG7T\r\nY5Z47GpAuADai4KoayA01vgKR9uJUQUxOt7VKK7jKrTgzCWDVbcVGyxLPsZQ\r\nvUD4wnmFkmvNCl1GiXCjrHRGOzbim+u7Z9V9Ve0phbK06c1n1ZusRuzYULPO\r\n988Qk/4a9bW8+MyFYNZ4omwY0+PgbPGrf78/KTaFxOEoSjA1x1wVJgLQTMa0\r\nO8QkylUUrRHOjZ+YvR3PiuhzKx3ZBmofcehgQnFGvk4v76ZEmWYlHq+dTnIB\r\n6z89ACCE3ea0DsVXNcsw9rE3EW0WfrJpy+DK9GQydCMZ/LLaMvZQFKWHnNJV\r\nFempEvqu+Zh/yCp+SJczcEQRa6VIucdXBFiFKM39QqOneJz72I+TPWc+oelE\r\nGTbc/nWVNB0iioFjF94EHjlcteflUeSx0Co=\r\n=XiCr\r\n-----END PGP SIGNATURE-----\r\n","size":14074,"noattachment":false,"key":"/cli-color/-/cli-color-2.0.3.tgz"},"_npmUser":{"name":"medikoo","email":"medikoo+npm@medikoo.com"},"directories":{},"maintainers":[{"name":"medikoo","email":"medikoo+npm@medikoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cli-color_2.0.3_1656957167354_0.9776502970147687"},"_hasShrinkwrap":false,"readme":"[![Build status][build-image]][build-url]\n[![Tests coverage][cov-image]][cov-url]\n[![npm version][npm-image]][npm-url]\n\n# cli-color\n\n## Yet another colors and formatting for the console solution\n\nColors, formatting and other goodies for the console. This package won't mess with built-ins and provides neat way to predefine formatting patterns, see below.\n\n## Installation\n\n    $ npm install cli-color\n\n## Usage\n\nUsage:\n\n```javascript\nvar clc = require(\"cli-color\");\n```\n\nOutput colored text:\n\n```javascript\nconsole.log(clc.red(\"Text in red\"));\n```\n\nStyles can be mixed:\n\n```javascript\nconsole.log(clc.red.bgWhite.underline(\"Underlined red text on white background.\"));\n```\n\nStyled text can be mixed with unstyled:\n\n```javascript\nconsole.log(clc.red(\"red\") + \" plain \" + clc.blue(\"blue\"));\n```\n\nStyled text can be nested:\n\n```javascript\nconsole.log(clc.red(\"red \" + clc.blue(\"blue\") + \" red\"));\n```\n\n**Best way is to predefine needed stylings and then use it**:\n\n```javascript\nvar error = clc.red.bold;\nvar warn = clc.yellow;\nvar notice = clc.blue;\n\nconsole.log(error(\"Error!\"));\nconsole.log(warn(\"Warning\"));\nconsole.log(notice(\"Notice\"));\n```\n\n_Note: No colors or styles are output when [`NO_COLOR` env var](https://no-color.org/) is set_\n\nSupported are all ANSI colors and styles:\n\n#### Styles\n\nStyles will display correctly if font used in your console supports them.\n\n- bold\n- italic\n- underline\n- blink\n- inverse\n- strike\n\n#### Colors\n\n<table>\n  <thead><th>Foreground</th><th>Background</th><th></th></thead>\n  <tbody>\n    <tr><td>black</td><td>bgBlack</td><td><img src=\"http://medyk.org/colors/000000.png\" width=\"30\" height=\"30\" /></td></tr>\n    <tr><td>red</td><td>bgRed</td><td><img src=\"http://medyk.org/colors/800000.png\" width=\"30\" height=\"30\" /></td></tr>\n    <tr><td>green</td><td>bgGreen</td><td><img src=\"http://medyk.org/colors/008000.png\" width=\"30\" height=\"30\" /></td></tr>\n    <tr><td>yellow</td><td>bgYellow</td><td><img src=\"http://medyk.org/colors/808000.png\" width=\"30\" height=\"30\" /></td></tr>\n    <tr><td>blue</td><td>bgBlue</td><td><img src=\"http://medyk.org/colors/000080.png\" width=\"30\" height=\"30\" /></td></tr>\n    <tr><td>magenta</td><td>bgMagenta</td><td><img src=\"http://medyk.org/colors/800080.png\" width=\"30\" height=\"30\" /></td></tr>\n    <tr><td>cyan</td><td>bgCyan</td><td><img src=\"http://medyk.org/colors/008080.png\" width=\"30\" height=\"30\" /></td></tr>\n    <tr><td>white</td><td>bgWhite</td><td><img src=\"http://medyk.org/colors/c0c0c0.png\" width=\"30\" height=\"30\" /></td></tr>\n  </tbody>\n</table>\n\n##### Bright variants\n\n<table>\n  <thead><th>Foreground</th><th>Background</th><th></th></thead>\n  <tbody>\n    <tr><td>blackBright</td><td>bgBlackBright</td><td><img src=\"http://medyk.org/colors/808080.png\" width=\"30\" height=\"30\" /></td></tr>\n    <tr><td>redBright</td><td>bgRedBright</td><td><img src=\"http://medyk.org/colors/ff0000.png\" width=\"30\" height=\"30\" /></td></tr>\n    <tr><td>greenBright</td><td>bgGreenBright</td><td><img src=\"http://medyk.org/colors/00ff00.png\" width=\"30\" height=\"30\" /></td></tr>\n    <tr><td>yellowBright</td><td>bgYellowBright</td><td><img src=\"http://medyk.org/colors/ffff00.png\" width=\"30\" height=\"30\" /></td></tr>\n    <tr><td>blueBright</td><td>bgBlueBright</td><td><img src=\"http://medyk.org/colors/0000ff.png\" width=\"30\" height=\"30\" /></td></tr>\n    <tr><td>magentaBright</td><td>bgMagentaBright</td><td><img src=\"http://medyk.org/colors/ff00ff.png\" width=\"30\" height=\"30\" /></td></tr>\n    <tr><td>cyanBright</td><td>bgCyanBright</td><td><img src=\"http://medyk.org/colors/00ffff.png\" width=\"30\" height=\"30\" /></td></tr>\n    <tr><td>whiteBright</td><td>bgWhiteBright</td><td><img src=\"http://medyk.org/colors/ffffff.png\" width=\"30\" height=\"30\" /></td></tr>\n  </tbody>\n</table>\n\n##### xTerm colors (256 colors table)\n\n**Not supported on Windows and some terminals**. However if used in not supported environment, the closest color from basic (16 colors) palette is chosen.\n\nUsage:\n\n```javascript\nvar msg = clc.xterm(202).bgXterm(236);\nconsole.log(msg(\"Orange text on dark gray background\"));\n```\n\nColor table:\n\n<img width=\"634\" alt=\"Screenshot 2022-07-04 at 12 28 18\" src=\"https://user-images.githubusercontent.com/122434/177136739-64a4bdd1-a1f5-453e-a7a0-55107bbd7922.png\">\n\n#### Reset\n\nTerminal can be cleared with `clc.reset`\n\n```javascript\nprocess.stdout.write(clc.reset);\n```\n\n#### Erase\n\n##### clc.erase.screen\n\nEntire screen\n\n```javascript\nprocess.stdout.write(clc.erase.screen);\n```\n\n##### clc.erase.screenLeft\n\nLeft portion of a screen\n\n```javascript\nprocess.stdout.write(clc.erase.screenLeft);\n```\n\n##### clc.erase.screenRight\n\nRight portion of a screen\n\n```javascript\nprocess.stdout.write(clc.erase.screenRight);\n```\n\n##### clc.erase.line\n\nCurrent line\n\n```javascript\nprocess.stdout.write(clc.erase.line);\n```\n\n##### clc.erase.lineRight\n\nRight portion of current line\n\n```javascript\nprocess.stdout.write(clc.erase.lineRight);\n```\n\n##### clc.erase.lineLeft\n\nLeft portion of current line\n\n```javascript\nprocess.stdout.write(clc.erase.lineLeft);\n```\n\n#### Move around functions\n\n##### clc.move(x, y)\n\nMove cursor _x_ columns and _y_ rows away. Values can be positive or negative, e.g.:\n\n```javascript\nprocess.stdout.write(clc.move(-2, -2)); // Move cursors two columns and two rows back\n```\n\n##### clc.move.to(x, y)\n\nAbsolute move. Sets cursor position at _x_ column and _y_ row\n\n```javascript\nprocess.stdout.write(clc.move.to(0, 0)); // Move cursor to first row and first column in terminal window\n```\n\n##### clc.move.up(n)\n\nMove cursor up _n_ rows\n\n```javascript\nprocess.stdout.write(clc.move.up(2));\n```\n\n##### clc.move.down(n)\n\nMove cursor down _n_ rows\n\n```javascript\nprocess.stdout.write(clc.move.down(2));\n```\n\n##### clc.move.right(n)\n\nMove cursor right _n_ columns\n\n```javascript\nprocess.stdout.write(clc.move.right(2));\n```\n\n##### clc.move.left(n)\n\nMove cursor left _n_ columns\n\n```javascript\nprocess.stdout.write(clc.move.left(2));\n```\n\n##### clc.move.lines(n)\n\nMove cursor `n` lines forward if `n` is positive, otherwise `n` lines backward, and place it at line beginning\n\n```javascript\nprocess.stdout.write(clc.move.lines(2));\n```\n\n##### clc.move.top\n\nMove cursor to top of a screen\n\n```javascript\nprocess.stdout.write(clc.move.top);\n```\n\n##### clc.move.bottom\n\nMove cursor to bottom of a screen\n\n```javascript\nprocess.stdout.write(clc.move.bottom);\n```\n\n##### clc.move.lineBegin\n\nMove cursor to begin of a line\n\n```javascript\nprocess.stdout.write(clc.move.lineBegin);\n```\n\n##### clc.move.lineEnd\n\nMove cursor to end of a line\n\n```javascript\nprocess.stdout.write(clc.move.lineEnd);\n```\n\n#### Terminal characteristics\n\n##### clc.windowSize.width\n\nReturns terminal width\n\n##### clc.windowSize.height\n\nReturns terminal height\n\n### Additional functionalities\n\n#### clc.slice(str[, begin[, end]])\n\nSlice provided string with preservation of eventual ANSI formatting\n\n```javascript\nvar clc = require(\"cli-color\");\n\nvar str = clc.bold(\"foo\") + \"bar\" + clc.red(\"elo\");\nvar sliced = clc.slice(str, 1, 7); // Same as: clc.bold('oo') + 'bar' + clc.red('e')\n```\n\n#### clc.strip(formatedText)\n\nStrips ANSI formatted string to plain text\n\n```javascript\nvar ansiStrip = require(\"cli-color/strip\");\n\nvar plain = ansiStrip(formatted);\n```\n\n#### clc.getStrippedLength(str)\n\nGet actual length of ANSI-formatted string\n\n```javascript\nvar clc = require(\"cli-color\");\n\nvar str = clc.bold(\"foo\") + \"bar\" + clc.red(\"elo\");\nclc.getStrippedLength(str); // 9\n```\n\n#### clc.art(text, styleConf)\n\nCreate a text-graphical art. Within `styleConf`, string replacements needs to be defined, which are then used to convert `text` to styled graphical text.\n\n```javascript\nvar text = \".........\\n\" + \". Hello .\\n\" + \".........\\n\";\nvar style = { \".\": clc.yellowBright(\"X\") };\n\nprocess.stdout.write(clc.art(text, style));\n```\n\n#### clc.columns(data[, options])\n\nOutputs aligned table of columns.\n\n`data` is expected to be an array (or other iterable structure) of rows, where each row is also an array (or other iterable structure) of content to display.\n\nSupported `options`:\n\n- `sep`: Custom colums separator (defaults to `|`)\n- `columns`: Per column customizations, as e.g. `[{ align: 'right' }, null, { align: 'left' }]`:\n  - `align`: Possible options: `'left'`, `'right` (efaults to `'left'`)\n\n```javascript\nvar clc = require(\"cli-color\");\n\nprocess.stdout.write(\n  clc.columns([\n    [clc.bold(\"First Name\"), clc.bold(\"Last Name\"), clc.bold(\"Age\")],\n    [\"John\", \"Doe\", 34],\n    [\"Martha\", \"Smith\", 20],\n    [\"Jan\", \"Kowalski\", 30]\n  ])\n);\n\n/* Outputs:\n\nFirst Name | Last Name | Age\nJohn       | Doe       | 34\nMartha     | Smith     | 20\nJan        | Kowalski  | 30\n*/\n```\n\n##### throbber(write, interval[, format])\n\nWrites throbber string to _write_ function at given _interval_. Optionally throbber output can be formatted with given _format_ function\n\n```javascript\nvar setupThrobber = require(\"cli-color/throbber\");\n\nvar throbber = setupThrobber(function (str) { process.stdout.write(str); }, 200);\n\nthrobber.start();\n\n// at any time you can stop/start throbber\nthrobber.stop();\n```\n\n## Tests\n\n    $ npm test\n\n## Security contact information\n\nTo report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.\n\n## Contributors\n\n- [@rentalhost](https://github.com/rentalhost) (David Rodrigues)\n  - Help with support for nested styles. Introduction of `clc.art` module, and significant improvements to tests coverage\n- [@StreetStrider](https://github.com/StreetStrider)\n  - Implementation of sophistcated `clc.slice` functionality, and introduction of `clc.getStrippedLength` utility\n\n[nix-build-image]: https://semaphoreci.com/api/v1/medikoo-org/cli-color/branches/master/shields_badge.svg\n[nix-build-url]: https://semaphoreci.com/medikoo-org/cli-color\n[win-build-image]: https://ci.appveyor.com/api/projects/status/mnd4catkeu181ll5?svg=true\n[win-build-url]: https://ci.appveyor.com/project/medikoo/cli-color\n[transpilation-image]: https://img.shields.io/badge/transpilation-free-brightgreen.svg\n[npm-image]: https://img.shields.io/npm/v/cli-color.svg\n[npm-url]: https://www.npmjs.com/package/cli-color\n\n---\n\n<div align=\"center\">\n\t<b>\n\t\t<a href=\"https://tidelift.com/subscription/pkg/npm-cli-color?utm_source=npm-cli-color&utm_medium=referral&utm_campaign=readme\">Get professional support for cli-color with a Tidelift subscription</a>\n\t</b>\n\t<br>\n\t<sub>\n\t\tTidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.\n\t</sub>\n</div>\n\n[build-image]: https://github.com/medikoo/cli-color/workflows/Integrate/badge.svg\n[build-url]: https://github.com/medikoo/cli-color/actions?query=workflow%3AIntegrate\n[cov-image]: https://img.shields.io/codecov/c/github/medikoo/cli-color.svg\n[cov-url]: https://codecov.io/gh/medikoo/cli-color\n[npm-image]: https://img.shields.io/npm/v/cli-color.svg\n[npm-url]: https://www.npmjs.com/package/cli-color\n","publish_time":1656957167577,"_cnpm_publish_time":1656957167577,"dist-tags":{"latest":"2.0.4"}}