{"name":"css-color-extractor","version":"1.1.0","description":"Extract from colors from CSS.","main":"index.js","keywords":["css","color"],"author":{"name":"Rob Sanchez","email":"info@robsanchez.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/rsanchez/css-color-extractor.git"},"bugs":{"url":"https://github.com/rsanchez/css-color-extractor/issues"},"homepage":"https://github.com/rsanchez/css-color-extractor","dependencies":{"array-unique":"^0.3.2","color":"^4.2.3"},"peerDependencies":{"postcss":"^8.0.0 || ^7.0.0 || ^6.0.0 || ^5.0.0"},"scripts":{"lint":"eslint index.js","fix":"eslint index.js --fix","test":"jest"},"devDependencies":{"eslint":"^8.41.0","eslint-config-standard":"^17.1.0","eslint-plugin-import":"^2.27.5","eslint-plugin-n":"^16.0.0","eslint-plugin-promise":"^6.1.1","jest":"^29.5.0"},"gitHead":"60f580be22e10f37d45a076d55b3b366676cba58","_id":"css-color-extractor@1.1.0","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-Cd96iMLd8SWJLmwPZ1hSz854q0jmSaKot4T6VI1ZDB+GisPL02fbETmMrFz4Hq6WoPIq78WJCa4LUa0QTsTh7A==","shasum":"b78210d10b4772bd5f8aa1b526459d9c41d09c2f","tarball":"http://registry-npm.ywwl.com/css-color-extractor/download/css-color-extractor-1.1.0.tgz","fileCount":5,"unpackedSize":13232,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCqYmBjTUNyOUSwzl+07jseBv6YNNs4ClzBuSv/hbw3EAIhAK40B3sgWd2Zysl7hr2Bm9ADrrv2ZmWttGSkoVHXSZfU"}],"size":4280,"noattachment":false,"key":"/css-color-extractor/-/css-color-extractor-1.1.0.tgz"},"_npmUser":{"name":"rsanchez","email":"info@robsanchez.com"},"directories":{},"maintainers":[{"name":"rsanchez","email":"info@robsanchez.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/css-color-extractor_1.1.0_1685498587302_0.19420069329358447"},"_hasShrinkwrap":false,"readme":"# CSS Color Extractor\n\nExtract colors (named, hex, rgb, rgba, hsl, and hsla) from CSS.\n\nThis tool is useful if you are re-skinning a site with a new color scheme and need a starting point for a new stylesheet.\n\nPowers http://www.css-color-extractor.com.\n\n```css\n.foo {\n  color: red;\n  border: 1px solid #ab560f;\n  font-size: 16px;\n  background-image: linear-gradient(to-bottom, red, blue);\n}\n\n.bar {\n  color: rgba(0, 128, 255, 0.5);\n}\n\n.baz {\n  display: block;\n}\n```\n\n```\nred\n#ab560f\nblue\nrgba(0, 128, 255, 0.5)\n```\n\nThis module looks at the following CSS properties for colors:\n\n* `color`\n* `background`\n* `background-color`\n* `background-image`\n* `border`\n* `border-top`\n* `border-right`\n* `border-bottom`\n* `border-left`\n* `border-color`\n* `border-top-color`\n* `border-right-color`\n* `border-bottom-color`\n* `border-left-color`\n* `outline`\n* `outline-color`\n* `text-decoration`\n* `text-decoration-color`\n* `text-shadow`\n* `box-shadow`\n* `fill`\n* `stroke`\n* `stop-color`\n* `flood-color`\n* `lighting-color`\n\n## Installation\n\n[![NPM version](https://badge.fury.io/js/css-color-extractor.svg)](https://www.npmjs.org/package/css-color-extractor)\n\n[Use npm](https://www.npmjs.org/doc/cli/npm-install.html).\n\n```\nnpm install css-color-extractor\n```\n\n## Usage\n\n```javascript\nvar extractor = require('css-color-extractor');\n\nvar options = {\n  withoutGrey: false, // set to true to remove rules that only have grey colors\n  withoutMonochrome: false, // set to true to remove rules that only have grey, black, or white colors\n  colorFormat: null, // transform colors to one of the following formats: hexString, hexaString, rgbString, percentString, hslString, hwbString, or keyword\n  allColors: false, // set to true to get all colors instead of unique colors\n  sort: null, // set to \"hue\" to sort colors in order of hue, or to \"frequency\" to sort colors by how many times they appear in the css\n};\n\n// extract from a full stylesheet\nextractor.fromCss('a { color: red; } p { color: blue; }');\n// => ['red', 'blue']\n\n// extract from a string\nextractor.fromString('1px solid blue');\n// => ['blue']\n\n// extract from a declaration\nextractor.fromDecl({ prop: 'color', value: '1px solid blue' });\n// => ['blue']\n```\n\n## CLI\n\nInstall the CLI tool:\n\n```\nnpm install -g css-color-extractor-cli\n```\n\nExtract colors as a list to stdout:\n\n```\ncss-color-extractor input.css\n```\n\nExtract colors from stdin:\n\n```\ncat input.css | css-color-extractor\n```\n\nUse the `--without-grey` or `--without-monochrome` flag(s):\n\n```\ncss-color-extractor input.css --without-grey\n```\n\nUse the `--color-format` option to transform color output format (`hexString`, `hexaString`, `rgbString`, `percentString`, `hslString`, `hwbString`, or `keyword`):\n\n```\ncss-color-extractor input.css --color-format=hslString\n```\n\nUse the `--sort` option to sort the list of colors (`hue` or `frequency`):\n\n```\ncss-color-extractor input.css --sort=hue\n```\n\nUse the `--inverse` option to remove colors from rules:\n\n```\ncss-color-extractor input.css output.css --inverse\n```\n\nExtract colors to file:\n\n```\ncss-color-extractor input.css output.txt\n```\n\nExtract colors to CSS format (includes original CSS selectors):\n\n```\ncss-color-extractor input.css output.css\n\n# or to stdout\ncss-color-extractor input.css --format=css\n```\n\n```css\n.foo {\n  color: red;\n  border: 1px solid #ab560f;\n  font-size: 16px;\n  background-image: linear-gradient(to-bottom, red, blue);\n}\n\n.bar {\n  color: rgba(0, 128, 255, 0.5);\n}\n\n.baz {\n  display: block;\n}\n```\n\nYields:\n```css\n.foo {\n  color: red;\n  border-color: #ab560f;\n  background-image: linear-gradient(to-bottom, red, blue);\n}\n\n.bar {\n  color: rgba(0, 128, 255, 0.5);\n}\n```\n\nExtract colors to JSON format:\n\n```\ncss-color-extractor input.css output.json\n\n# or to stdout\ncss-color-extractor input.css --format=json\n```\n\n```css\n.foo {\n  color: red;\n  border: 1px solid #ab560f;\n  font-size: 16px;\n  background-image: linear-gradient(to-bottom, red, blue);\n}\n\n.bar {\n  color: rgba(0, 128, 255, 0.5);\n}\n\n.baz {\n  display: block;\n}\n```\n\nYields:\n```js\n[\"red\",\"#ab560f\",\"blue\",\"rgba(0, 128, 255, 0.5)\"]\n```\n\nExtract colors to HTML format (page of color swatches):\n\n```\ncss-color-extractor input.css output.html\n\n# or to stdout\ncss-color-extractor input.css --format=html\n```\n\n```css\n.foo {\n  color: yellow;\n  border: 1px solid #ab560f;\n  font-size: 16px;\n  background-image: linear-gradient(to-bottom, red, blue);\n}\n\n.bar {\n  color: rgba(0, 128, 255, 0.5);\n}\n\n.baz {\n  display: block;\n}\n```\n\nYields:\n\n```html\n<!DOCTYPE html>\n<html>\n<head>\n    <title>Colors</title>\n</head>\n<body>\n    <div class=\"container\">\n        <ul class=\"swatches\">\n            <li class=\"swatch swatch\" style=\"background-color: yellow;\">yellow</li>\n            <li class=\"swatch swatch-dark\" style=\"background-color: #ab560f;\">#ab560f</li>\n            <li class=\"swatch swatch-dark\" style=\"background-color: rgba(0, 128, 255, 0.5);\">rgba(0, 128, 255, 0.5)</li>\n            <li class=\"swatch swatch-dark\" style=\"background-color: blue;\">blue</li>\n        </ul>\n    </div>\n</body>\n</html>\n```\n\n## License\n\nCopyright (c) 2015 [Rob Sanchez](https://github.com/rsanchez)\n\nLicensed under [the MIT License](./LICENSE).\n","publish_time":1685498587505,"_cnpm_publish_time":1685498587505,"dist-tags":{"latest":"1.1.4"}}