{"name":"color-convert","description":"Plain color conversion functions","version":"3.0.1","author":{"name":"Josh Junon","email":"josh@junon.me"},"contributors":[{"name":"Heather Arthur","email":"fayearthur@gmail.com"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Qix-/color-convert.git"},"type":"module","exports":"./index.js","types":"./index.d.ts","engines":{"node":">=14.6"},"scripts":{"test":"xo && tsd && node test/basic.js"},"keywords":["color","colour","convert","converter","conversion","rgb","hsl","hsv","hwb","cmyk","ansi","ansi16"],"xo":{"rules":{"default-case":0,"no-inline-comments":0,"operator-linebreak":0,"unicorn/prefer-exponentiation-operator":0,"@typescript-eslint/naming-convention":0}},"devDependencies":{"chalk":"^5.2.0","jimp":"^0.22.8","tsd":"^0.28.1","xo":"^0.54.2"},"dependencies":{"color-name":"^2.0.0"},"_id":"color-convert@3.0.1","gitHead":"f53dad2f14e055e0bc7b4434ca13ec0435092172","bugs":{"url":"https://github.com/Qix-/color-convert/issues"},"homepage":"https://github.com/Qix-/color-convert#readme","_nodeVersion":"20.5.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-5kQah2eolfQV7HCrxtsBBArPfT5dwaKYMCXeMQsdRO7ihTO/cuNLGjd50ITCDn+ZU/YbS0Go64SjP9154eopxg==","shasum":"c0d327fd53cb93dfac3ba60fb04f2f8069638d6f","tarball":"http://registry-npm.ywwl.com/color-convert/download/color-convert-3.0.1.tgz","fileCount":7,"unpackedSize":44568,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHr/XjL/sYDNX2VxL8poY6vfKDdFOXEA+O1CVRmK9yDnAiEAiMJMQkqLwBQjQQ2U+KO/Fq0RquYuK84ag6Z3T3G0mDM="}],"size":11880,"noattachment":false,"key":"/color-convert/-/color-convert-3.0.1.tgz"},"_npmUser":{"name":"qix","email":"npm@josh.junon.me"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/color-convert_3.0.1_1738941873602_0.0683810567928842"},"_hasShrinkwrap":false,"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":1738941873783,"maintainers":[{"name":"qix","email":"npm@josh.junon.me"}],"_cnpm_publish_time":1738941873783,"dist-tags":{"latest":"3.1.3"}}