{"name":"color-convert","version":"3.0.0","keywords":["color","colour","convert","converter","conversion","rgb","hsl","hsv","hwb","cmyk","ansi","ansi16"],"author":{"name":"Josh Junon","email":"josh@junon.me"},"license":"MIT","_id":"color-convert@3.0.0","contributors":[{"name":"Heather Arthur","email":"fayearthur@gmail.com"}],"homepage":"https://github.com/Qix-/color-convert#readme","bugs":{"url":"https://github.com/Qix-/color-convert/issues"},"xo":{"rules":{"default-case":0,"no-inline-comments":0,"operator-linebreak":0,"@typescript-eslint/naming-convention":0,"unicorn/prefer-exponentiation-operator":0}},"dist":{"shasum":"f55904b7c59a8f7db3df0dba2df92c58fb2554fa","tarball":"http://registry-npm.ywwl.com/color-convert/download/color-convert-3.0.0.tgz","fileCount":7,"integrity":"sha512-m65xBZ5vGd9Mxtaw/QSGoC5UykQoIksUfcQZ1w3kzl12jM3u1loRAkgXXSkbXp0+/vEslCW4BCajnXLZlxIstA==","signatures":[{"sig":"MEUCIQDoy8czpZ3M4DeJkrdGXhm8f7Sa24QdXZbxKavA5D537gIgCl4+ADKFeD2swEHmlO1qHJKEUv4foHE4Y/qxJAueqmA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32344,"size":9913,"noattachment":false,"key":"/color-convert/-/color-convert-3.0.0.tgz"},"type":"module","types":"./index.d.ts","engines":{"node":">=14.6"},"exports":"./index.js","gitHead":"e0a2fbb4c765ea743038e0357d2090efcb5f07ef","scripts":{"test":"xo && tsd && node test/basic.js"},"_npmUser":{"name":"qix","email":"npm@josh.junon.me"},"repository":{"url":"git+https://github.com/Qix-/color-convert.git","type":"git"},"_npmVersion":"10.9.2","description":"Plain color conversion functions","directories":{},"_nodeVersion":"20.5.1","dependencies":{"color-name":"^2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^0.54.2","tsd":"^0.28.1","jimp":"^0.22.8","chalk":"^5.2.0"},"_npmOperationalInternal":{"tmp":"tmp/color-convert_3.0.0_1738782064730_0.6999622000999861","host":"s3://npm-registry-packages-npm-production"},"readme":"# color-convert\n\nColor-convert is a color conversion library for JavaScript and node.\nIt converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest):\n\n```js\nimport convert from 'color-convert';\n\nconvert.rgb.hsl(140, 200, 100);             // [96, 48, 59]\nconvert.keyword.rgb('blue');                // [0, 0, 255]\n\nconst rgbChannels = convert.rgb.channels;     // 3\nconst cmykChannels = convert.cmyk.channels;   // 4\nconst ansiChannels = convert.ansi16.channels; // 1\n```\n\n# Install\n\n```sh\nnpm install color-convert\n```\n\n# API\n\nSimply get the property of the _from_ and _to_ conversion that you're looking for.\n\nAll functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function.\n\nAll 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha).\n\n```js\nimport convert from 'color-convert';\n\n// Hex to LAB\nconvert.hex.lab('DEADBF');         // [ 76, 21, -2 ]\nconvert.hex.lab.raw('DEADBF');     // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ]\n\n// RGB to CMYK\nconvert.rgb.cmyk(167, 255, 4);     // [ 35, 0, 98, 0 ]\nconvert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ]\n```\n\n### Arrays\nAll functions that accept multiple arguments also support passing an array.\n\nNote that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.)\n\n```js\nimport convert from 'color-convert';\n\nconvert.rgb.hex(123, 45, 67);      // '7B2D43'\nconvert.rgb.hex([123, 45, 67]);    // '7B2D43'\n```\n\n## Routing\n\nConversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex).\n\nKeep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of \"direct\" (single-step) conversions, see [conversions.js](conversions.js).\n\n## Color Space Scales\nConversions rely on an agreed upon 'full-scale' value for each of the channels. Listed here are those values for the most common color spaces\n\n### rgb\nchannel | full-scale value\n---|---\nr | 255\ng | 255\nb | 255\n\n### hsl\nchannel | full-scale value\n---|---\nh | 360\ns | 100\nl | 100\n\n### hsv\nchannel | full-scale value\n---|---\nh | 360\ns | 100\nv | 100\n\n### hwb\nchannel | full-scale value\n---|---\nh | 360\nw | 100\nb | 100\n\n### cmyk\nchannel | full-scale value\n---|---\nc | 100\nm | 100\ny | 100\nk | 100\n\n### hex\nchannel | full-scale value\n---|---\nhex | ```0xffffff```\n\n### keyword\nchannel | value\n---|---\nname | any key from [color-name](https://github.com/colorjs/color-name/blob/master/index.js)\n\n### apple\nchannel | full-scale value\n---|---\n0 | 65535\n1 | 65535\n2 | 65535\n\n### gray\nchannel | full-scale value\n---|---\ngray | 100\n\n# Contribute\n\nIf there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request.\n\n# License\nCopyright &copy; 2011-2016, Heather Arthur.\nCopyright &copy; 2016-2021, Josh Junon.\n\nLicensed under the [MIT License](LICENSE).\n","publish_time":1738782064922,"maintainers":[{"name":"qix","email":"npm@josh.junon.me"}],"_cnpm_publish_time":1738782064922,"dist-tags":{"latest":"3.1.3"}}