{"name":"moo-color","version":"2.0.0","description":"A modern TypeScript library for color parsing, conversion, and manipulation.","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","browser":"./dist/moo-color.global.js","unpkg":"./dist/moo-color.global.js","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"sideEffects":false,"scripts":{"build":"tsup","test":"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","typecheck":"tsc --noEmit","clean":"rimraf dist"},"keywords":["color","color-conversion","color-manipulation","hex","rgb","hsl","hwb","hsv","cmyk","wcag","typescript"],"author":{"name":"archcoster@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/archco/moo-color.git"},"bugs":{"url":"https://github.com/archco/moo-color/issues"},"homepage":"https://github.com/archco/moo-color#readme","engines":{"node":">=18"},"dependencies":{"color-name":"^2.0.0"},"devDependencies":{"@types/color-name":"^1.1.3","tsup":"^8.4.0","typescript":"^5.7.0","vitest":"^3.1.0"},"_id":"moo-color@2.0.0","gitHead":"ccdb1159864ab3d68f34e01a6dfc82be4ccefd17","_nodeVersion":"24.13.1","_npmVersion":"11.4.0","dist":{"integrity":"sha512-/6YS26ppXHHqdsZDzbg53OsudDe+Am6vup7B4cAxrsqvWGWINz09K9PHQGwU28Vtb68hpygDbKj6XfJuJGq0+g==","shasum":"0bcbda16a93def04b80b3272f0a91d257dbc42ef","tarball":"http://registry-npm.ywwl.com/moo-color/download/moo-color-2.0.0.tgz","fileCount":11,"unpackedSize":255519,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCFnsd4GCEN4GdTRweoaQgt4rpenTkNTFpn5zshY42wiQIgazi0d/ALoASd/ShERNmaIl15o8OUBvSzB0TEzUkariw="}],"size":57312,"noattachment":false,"key":"/moo-color/-/moo-color-2.0.0.tgz"},"_npmUser":{"name":"archco","email":"archcoster@gmail.com"},"directories":{},"maintainers":[{"name":"archco","email":"archcoster@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/moo-color_2.0.0_1775052500894_0.27222002671054435"},"_hasShrinkwrap":false,"readme":"# MooColor\n\n[![CI](https://github.com/archco/moo-color/actions/workflows/node.js.yml/badge.svg)](https://github.com/archco/moo-color/actions/workflows/node.js.yml)\n[![npm version](https://badge.fury.io/js/moo-color.svg)](https://www.npmjs.com/package/moo-color)\n[![Downloads](https://img.shields.io/npm/dm/moo-color.svg)](https://www.npmjs.com/package/moo-color)\n\nA modern TypeScript library for color parsing, conversion, and manipulation.\n\n- **Immutable** — every manipulation method returns a new instance; the original is never mutated.\n- **WCAG 2.1 compliant** — `luminance` and `contrastRatio` use the correct sRGB linearization.\n- **Dual build** — ships ESM, CJS, and IIFE bundles out of the box.\n- **Fully typed** — ships its own `.d.ts` including Template Literal Types for color strings.\n\n## Install\n\n```sh\nnpm install moo-color\n```\n\n## Usage\n\n### ESM / TypeScript\n\n```ts\nimport { MooColor } from 'moo-color';\n\nconst red = new MooColor('#ff0000');\n\n// Manipulation returns a NEW instance — original is untouched\nconst light = red.lighten(20);\nconsole.log(red.toHex());    // '#ff0000'\nconsole.log(light.toHex());  // '#ff6666'\n\n// Method chaining\nnew MooColor('hsl(0, 100%, 50%)')\n  .rotate(120)\n  .saturate(10)\n  .toHex('short'); // '#00ff22' (approximately)\n```\n\n### CommonJS\n\n```js\nconst { MooColor } = require('moo-color');\n\nconst color = new MooColor('rgb(255, 128, 0)');\nconsole.log(color.toHsl()); // 'hsl(30, 100%, 50%)'\n```\n\n### Browser (IIFE via `<script>`)\n\n```html\n<script src=\"https://unpkg.com/moo-color/dist/moo-color.global.js\"></script>\n<script>\n  const color = new MooColor('hsl(200, 80%, 50%)');\n  console.log(color.toHex()); // '#1aa3e8'\n</script>\n```\n\n## Quick Examples\n\n```ts\n// Parsing — accepts hex, rgb, hsl, hwb, hsv, cmyk, named colors, transparent\nnew MooColor('#f00');\nnew MooColor('rgba(255, 0, 0, 0.5)');\nnew MooColor('hsl(0, 100%, 50%)');\nnew MooColor('red');\n\n// Formatting\nconst c = new MooColor('red');\nc.toHex();          // '#ff0000'\nc.toHex('short');   // '#f00'\nc.toHex('name');    // 'red'\nc.toRgb();          // 'rgb(255, 0, 0)'\nc.toHsl();          // 'hsl(0, 100%, 50%)'\nc.toHwb();          // 'hwb(0, 0%, 0%)'\n\n// WCAG 2.1 contrast\nconst white = new MooColor('#fff');\nconst black = new MooColor('#000');\nblack.contrastRatioWith(white);   // 21\nblack.isContrastEnough(white);    // true (≥ 4.5)\n\n// Random color\nconst rand = MooColor.random({ hue: [0, 60], white: 20 });\n```\n\n## API\n\nPlease see [MooColor API](https://github.com/archco/moo-color/tree/master/docs#moocolor-api).\n\n## Change Log\n\n[CHANGELOG.md](https://github.com/archco/moo-color/blob/master/CHANGELOG.md)\n\n## License\n\n[MIT License](https://github.com/archco/moo-color/blob/master/LICENSE)\n","publish_time":1775052501060,"_cnpm_publish_time":1775052501060,"dist-tags":{"latest":"2.0.0"}}