UNPKG

yapm

Version:

package manager for io.js (npm fork)

66 lines (65 loc) 5.06 kB
{ "name": "chalk", "version": "0.4.0", "description": "Terminal string styling done right. Created because the `colors` module does some really horrible things.", "license": "MIT", "repository": { "type": "git", "url": "git://github.com/sindresorhus/chalk" }, "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "http://sindresorhus.com" }, "engines": { "node": ">=0.8.0" }, "scripts": { "test": "mocha" }, "files": [ "index.js" ], "keywords": [ "color", "colour", "colors", "terminal", "console", "cli", "string", "ansi", "styles", "tty", "formatting", "rgb", "256", "shell", "xterm", "log", "logging", "command-line", "text" ], "dependencies": { "has-color": "~0.1.0", "ansi-styles": "~1.0.0", "strip-ansi": "~0.1.0" }, "devDependencies": { "mocha": "~1.x" }, "readme": "# <img width=\"250\" src=\"logo.png\" alt=\"chalk\">\n\n> Terminal string styling done right\n\n[![Build Status](https://secure.travis-ci.org/sindresorhus/chalk.png?branch=master)](http://travis-ci.org/sindresorhus/chalk)\n\n[colors.js](https://github.com/Marak/colors.js) is currently the most popular string styling module, but it has serious deficiencies like extending String.prototype which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68). Although there are other ones, they either do too much or not enough.\n\n**Chalk is a clean and focused alternative.**\n\n![screenshot](screenshot.png)\n\n\n## Why\n\n- **Doesn't extend String.prototype**\n- Expressive API\n- Clean and focused\n- Auto-detects color support\n- Actively maintained\n- [Used by 150+ modules](https://npmjs.org/browse/depended/chalk)\n\n\n## Install\n\nInstall with [npm](https://npmjs.org/package/chalk): `npm install --save chalk`\n\n\n## Example\n\nChalk comes with an easy to use composable API where you just chain and nest the styles you want.\n\n```js\nvar chalk = require('chalk');\n\n// style a string\nconsole.log( chalk.blue('Hello world!') );\n\n// combine styled and normal strings\nconsole.log( chalk.blue('Hello'), 'World' + chalk.red('!') );\n\n// compose multiple styles using the chainable API\nconsole.log( chalk.blue.bgRed.bold('Hello world!') );\n\n// nest styles\nconsole.log( chalk.red('Hello', chalk.underline.bgBlue('world') + '!') );\n\n// pass in multiple arguments\nconsole.log( chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz') );\n```\n\nYou can easily define your own themes.\n\n```js\nvar chalk = require('chalk');\nvar error = chalk.bold.red;\nconsole.log(error('Error!'));\n```\n\n\n## API\n\n### chalk.`<style>[.<style>...](string, [string...])`\n\nExample: `chalk.red.bold.underline('Hello', 'world');`\n\nChain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter.\n\nMultiple arguments will be separated by space.\n\n### chalk.enabled\n\nColor support is automatically detected, but you can override it.\n\n### chalk.supportsColor\n\nDetect whether the terminal [supports color](https://github.com/sindresorhus/has-color).\n\nCan be overridden by the user with the flags `--color` and `--no-color`.\n\nUsed internally and handled for you, but exposed for convenience.\n\n### chalk.styles\n\nExposes the styles as [ANSI escape codes](https://github.com/sindresorhus/ansi-styles).\n\nGenerally not useful, but you might need just the `.open` or `.close` escape code if you're mixing externally styled strings with yours.\n\n```js\nvar chalk = require('chalk');\n\nconsole.log(chalk.styles.red);\n//=> {open: '\\x1b[31m', close: '\\x1b[39m'}\n\nconsole.log(chalk.styles.red.open + 'Hello' + chalk.styles.red.close);\n```\n\n### chalk.stripColor(string)\n\n[Strip color](https://github.com/sindresorhus/strip-ansi) from a string.\n\nCan be useful in combination with `.supportsColor` to strip color on externally styled text when it's not supported.\n\nExample:\n\n```js\nvar chalk = require('chalk');\nvar styledString = fromExternal();\n\nif (!chalk.supportsColor) {\n\tchalk.stripColor(styledString);\n}\n```\n\n\n## Styles\n\n### General\n\n- reset\n- bold\n- italic\n- underline\n- inverse\n- strikethrough\n\n### Text colors\n\n- black\n- red\n- green\n- yellow\n- blue\n- magenta\n- cyan\n- white\n- gray\n\n### Background colors\n\n- bgBlack\n- bgRed\n- bgGreen\n- bgYellow\n- bgBlue\n- bgMagenta\n- bgCyan\n- bgWhite\n\n\n## License\n\nMIT © [Sindre Sorhus](http://sindresorhus.com)\n\n\n-\n\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/sindresorhus/chalk/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n", "readmeFilename": "readme.md", "bugs": { "url": "https://github.com/sindresorhus/chalk/issues" }, "homepage": "https://github.com/sindresorhus/chalk", "_id": "chalk@0.4.0", "dist": { "shasum": "5199a3ddcd0c1efe23bc08c1b027b06176e0c64f" }, "_from": "chalk@~0.4.0", "_resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz" }