{"bugs":{"url":"https://github.com/markusn/color-diff/issues"},"dist":{"shasum":"a1f2fc1d7f329c79d5f8befe08a36d2be722b970","tarball":"https://registry.npmjs.org/color-diff/-/color-diff-1.4.0-beta.2.tgz","fileCount":9,"integrity":"sha512-68FEYMH5sUkLKEjZoxITicUIsyYH+SGZhbfY5HdSgsy1rjEP89J6D1D8KzsrroNiHYStl8YCoV3J3eSkCLNDZw==","signatures":[{"sig":"MEQCIG3o4yqOFub6TzivKi6NScZtmaEE4OaH9FTF+hKPGtcFAiA53c6R4kLfPm2E3OHHH37GaZG/HV20yvjq+0Sv70Oe7Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":47461},"main":"index.js","name":"color-diff","type":"module","author":{"name":"markusn kael"},"readme":"# color-diff\n\n[![Build Status](https://github.com/markusn/color-diff/actions/workflows/build-latest.yaml/badge.svg?branch=master)](https://github.com/markusn/color-diff/actions/workflows/build-latest.yaml)\n[![Coverage Status](https://coveralls.io/repos/markusn/color-diff/badge.png?branch=master)](https://coveralls.io/r/markusn/color-diff?branch=master)\n\nImplements the CIEDE2000 color difference algorithm, conversion between RGB and\nLAB color and mapping all colors in palette X to the closest color in palette Y\nbased on the CIEDE2000 difference.\n\n## Installation\n\n```bash\nnpm install color-diff --save\n```\n\n## Tests\n\nAre located in the `test/` folder and are run by:\n\n```bash\nnpm test\n```\n\n## Usage\n\n```js\n// CommonJS\nconst { \n  closest, \n  furthest,\n  diff, \n  mapPalette,\n  paletteMapKey,\n  rgbaToLab,\n  mapPaletteLab,\n  labPaletteMapKey,\n} = require(\"color-diff\");\n\n// ESM\nimport {\n  closest,\n  furthest,\n  diff,\n  mapPalette,\n  paletteMapKey,\n  rgbaToLab,\n  mapPaletteLab,\n  labPaletteMapKey,\n} from \"color-diff\";\n```\n\n### closest(color, palette, bc)\n\nReturns the closest color. The parameter bc is optional and is used as\nbackground color when the color and/or palette uses alpha channels.\n\n```js\nconst color = { R: 255, G: 1, B: 30 };\n// red, green, blue\nconst palette = [ {R: 255, G: 0, B: 0 },\n                {R: 0, G: 255, B: 0 },\n                {R: 0, G: 0, B: 255} ];\n\nclosest(color, palette); // {R: 255, G: 0, B: 0 }, red\n```\n\nThe result above is obvious, but `diff.closest` could deal with more complicated\ncases.\n\n### furthest(color, palette, bc)\n\nReturns the most different color. The parameter bc is optional and is used as\nbackground color when the color and/or palette uses alpha channels.\n\n```js\nconst color = { R: 255, G: 255, B: 255 };\n// black, white\nconst palette = [ {R: 0, G: 0, B: 0 }, {R: 255, G: 255, B: 255 } ];\n\nfurthest(color, palette); // {R: 0, G: 0, B: 0 }, black\n```\n\nThe result above is obvious, but `diff.furthest` could deal with more\ncomplicated cases.\n\n### mapPalette(palette1, palette2)\n\nReturns a mapping from the colors in palette1 to palette2.\n\n### paletteMapKey(color)\n\nReturn the palette map key for the color, to be used with the result from mapPalette.\n\n### diff(color1, color2, bc)\n\nReturns the difference between the lab colors color1 and color2. The parameter bc is optional and\nis used as background color when one of the colors uses alpha channels.\n\n#### rgba color\n\n`Object`\n\n`RGBAColor` is an object containing 4 properties: 'R', 'G', 'B', 'A', where 'A' is optional OR\n'r', 'g', 'b', 'a', where 'a' is optional . Such as:\n\n```js\n{ R: 255, G: 1, B: 0 }\n```\n\nThere is an optional property 'A', which specifies the alpha channel between 0.0\nand 1.0. If not present the color will be treated as fully opaque, i.e. A = 1.0.\n\nEach RGBA-color is transformed into a RGB-color before being used to calculate\nthe CIEDE2000 difference, using the specified background color\n(defaults to white).\n\n### lab color\n\n`Object`\n\n`LabColor` is an object containing 3 properties 'L', 'a', 'b' such as:\n\n```js\n{ L: 100, a: 0.005, b: -0.010 }\n```\n\n#### palette\n\n`Array.<RGBAColor>`\n\nColor palette array which contains many `RGBAColor` objects.\n\n## Author\n\nMarkus Ekholm\n\n## License\n\n3-clause BSD. For details see `COPYING`.\n","exports":{"import":"./index.js","require":"./index.cjs"},"gitHead":"61269601ac72e65afd111565bfa68a2d13092de0","license":"BSD-3-Clause","scripts":{"dist":"rollup index.js --format cjs --file index.cjs","test":"c8 --reporter=lcov mocha && eslint . --cache && tsc"},"_npmUser":{"name":"markusn","email":"markus@botten.org"},"homepage":"https://github.com/markusn/color-diff#readme","keywords":["color","diff","color-diff","pallette","closest","convert","conversion","CIEDE2000","ciede2000"],"repository":{"url":"git://github.com/markusn/color-diff.git","type":"git"},"_npmVersion":"9.5.0","description":"Implemets the CIEDE2000 color difference algorithm, conversion between RGB and LAB color and mapping all colors in palette X to the closest or most different color in palette Y based on the CIEDE2000 difference.","directories":{},"maintainers":[{"name":"markusn","email":"markus@botten.org"}],"_nodeVersion":"18.15.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"c8":"^7.14.0","mocha":"^10.0.0","eslint":"^8.24.0","rollup":"^3.23.0","typescript":"^5.0.4","@types/node":"^18.15.13","@types/mocha":"^10.0.1","eslint-config-exp":"^0.5.0"},"_npmOperationalInternal":{"tmp":"tmp/color-diff_1.4.0-beta.2_1685562532957_0.3631341471079741","host":"s3://npm-registry-packages"},"_id":"color-diff@1.4.0-beta.2","version":"1.4.0-beta.2"}