{"_id":"@basementuniverse/color","_rev":"7-760165de97f987c0d302c6c09001e484","name":"@basementuniverse/color","dist-tags":{"latest":"1.6.1"},"versions":{"1.0.0":{"name":"@basementuniverse/color","version":"1.0.0","author":{"url":"https://gordonlarrigan.com","name":"Gordon Larrigan","email":"gordonlarrigan@gmail.com"},"license":"MIT","_id":"@basementuniverse/color@1.0.0","maintainers":[{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"}],"homepage":"https://github.com/basementuniverse/color#readme","bugs":{"url":"https://github.com/basementuniverse/color/issues"},"dist":{"shasum":"05b38301d3d25e2ce0a024f860add7dfc3976fe8","tarball":"https://registry.npmjs.org/@basementuniverse/color/-/color-1.0.0.tgz","fileCount":5,"integrity":"sha512-JYz0x1Vbmx2Gs0KXiAOVEVoxpaBt75av/AyPS8rQ9Li7jIlCJvwS60wJlgzv0DwQIJVGemv1vGftwqATLhsULQ==","signatures":[{"sig":"MEQCIDIxiQQeyXtcUm1nJYhsnhH+cxaAyCX/uKCxXWFgRfZmAiBC6cpbGuLJC4bA/q+/yDHcZ4ZdQDMssYU0ISagU6Wm2g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":21329},"main":"build/index.js","types":"./build/index.d.ts","gitHead":"61070bbc57363420abf9940b2e0f447e07889190","scripts":{"test":"qunit","build":"webpack","watch":"webpack --watch"},"_npmUser":{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"},"repository":{"url":"git+https://github.com/basementuniverse/color.git","type":"git"},"_npmVersion":"11.5.1","description":"A small colour utilities library.","directories":{},"_nodeVersion":"24.5.0","_hasShrinkwrap":false,"devDependencies":{"qunit":"^2.24.2","webpack":"^5.3.2","ts-loader":"^8.0.7","typescript":"^4.9.4","@types/node":"^18.11.12","webpack-cli":"^4.1.0","clean-webpack-plugin":"^4.0.0-alpha.0"},"_npmOperationalInternal":{"tmp":"tmp/color_1.0.0_1760386138402_0.5061315242839162","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@basementuniverse/color","version":"1.1.0","author":{"url":"https://gordonlarrigan.com","name":"Gordon Larrigan","email":"gordonlarrigan@gmail.com"},"license":"MIT","_id":"@basementuniverse/color@1.1.0","maintainers":[{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"}],"homepage":"https://github.com/basementuniverse/color#readme","bugs":{"url":"https://github.com/basementuniverse/color/issues"},"dist":{"shasum":"49d663c24b520c75243d0cbe687d8ba7d6613355","tarball":"https://registry.npmjs.org/@basementuniverse/color/-/color-1.1.0.tgz","fileCount":5,"integrity":"sha512-RGkRP4dOBZJ/1P0/8f6R4cElRKUm8FKpnClB9uyc/yMmWJ/gLRxGYaVclu/WvIHwLYwwKciSqYW+N1XT3CYlVQ==","signatures":[{"sig":"MEUCIQC7IGbrDe4eP9CWu4+q0jmR0yunPkvPcSiGfzHaxoIMeQIgJWi6hZU/kHJejeK7W2JKWduzUqE4PgDRC8dLHOXNmO8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24581},"main":"build/index.js","types":"./build/index.d.ts","gitHead":"29c99a58f05c737e82437ab86961231ddb61e9c9","scripts":{"test":"qunit","build":"webpack","watch":"webpack --watch"},"_npmUser":{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"},"repository":{"url":"git+https://github.com/basementuniverse/color.git","type":"git"},"_npmVersion":"11.5.1","description":"A small colour utilities library.","directories":{},"_nodeVersion":"24.5.0","_hasShrinkwrap":false,"devDependencies":{"qunit":"^2.24.2","webpack":"^5.3.2","ts-loader":"^8.0.7","typescript":"^4.9.4","@types/node":"^18.11.12","webpack-cli":"^4.1.0","clean-webpack-plugin":"^4.0.0-alpha.0"},"_npmOperationalInternal":{"tmp":"tmp/color_1.1.0_1760390381593_0.759125588740523","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@basementuniverse/color","version":"1.2.0","author":{"url":"https://gordonlarrigan.com","name":"Gordon Larrigan","email":"gordonlarrigan@gmail.com"},"license":"MIT","_id":"@basementuniverse/color@1.2.0","maintainers":[{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"}],"homepage":"https://github.com/basementuniverse/color#readme","bugs":{"url":"https://github.com/basementuniverse/color/issues"},"dist":{"shasum":"452ac0957caa693a487d8959ca73e02afb8ddbb5","tarball":"https://registry.npmjs.org/@basementuniverse/color/-/color-1.2.0.tgz","fileCount":5,"integrity":"sha512-VioJ5WbipLli9Q6Yay0ZlHyKEwNJ0tZ3qQDVj1bLnEruOWeWiFqyDiQ0yv+NlljuqouwWkFlMbHsfzsDL2LpaQ==","signatures":[{"sig":"MEUCIBV1bQvrMdC3k+4rpVgpvQyJH9oP1NYO8H/Cue5JdoAyAiEAzhKb/eJAKqQjt7pyvu66QYNnIh46xpiAcIhURPEKeMs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26431},"main":"build/index.js","types":"./build/index.d.ts","gitHead":"f1afd0268562ef0cabc85190a2ddaf58f826e0de","scripts":{"test":"qunit","build":"webpack","watch":"webpack --watch"},"_npmUser":{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"},"repository":{"url":"git+https://github.com/basementuniverse/color.git","type":"git"},"_npmVersion":"11.6.2","description":"A small colour utilities library.","directories":{},"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"devDependencies":{"qunit":"^2.24.2","webpack":"^5.3.2","ts-loader":"^8.0.7","typescript":"^4.9.4","@types/node":"^18.11.12","webpack-cli":"^4.1.0","clean-webpack-plugin":"^4.0.0-alpha.0"},"_npmOperationalInternal":{"tmp":"tmp/color_1.2.0_1773483967582_0.9390892644763367","host":"s3://npm-registry-packages-npm-production"}},"1.4.0":{"name":"@basementuniverse/color","version":"1.4.0","author":{"url":"https://gordonlarrigan.com","name":"Gordon Larrigan","email":"gordonlarrigan@gmail.com"},"license":"MIT","_id":"@basementuniverse/color@1.4.0","maintainers":[{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"}],"homepage":"https://github.com/basementuniverse/color#readme","bugs":{"url":"https://github.com/basementuniverse/color/issues"},"dist":{"shasum":"4c770031ca2e94e8b178bcf2858bdb46049464f9","tarball":"https://registry.npmjs.org/@basementuniverse/color/-/color-1.4.0.tgz","fileCount":5,"integrity":"sha512-BTXJQoPoJ3BHFvmmVoBlmiPe7c5t53rIDpDEyWZ+Ovlat3SsXQ9mefVDBPgjkJPvoyDGQtLwaijcrrLroB23tA==","signatures":[{"sig":"MEUCIAxkNKNTiHj3yx1qdoyuLcsYoEBCXngjp/ADbHFUTYr/AiEAjbXopThRTa38fqREVRmzry6dGkcGjrqw8OIvR8ozWXI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33137},"main":"build/index.js","types":"./build/index.d.ts","gitHead":"8cd656e6f5293fa3a1829ae3cdd072f26db284d0","scripts":{"test":"qunit","build":"webpack","watch":"webpack --watch"},"_npmUser":{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"},"repository":{"url":"git+https://github.com/basementuniverse/color.git","type":"git"},"_npmVersion":"11.6.2","description":"A small colour utilities library.","directories":{},"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"devDependencies":{"qunit":"^2.24.2","webpack":"^5.3.2","ts-loader":"^8.0.7","typescript":"^4.9.4","@types/node":"^18.11.12","webpack-cli":"^4.1.0","clean-webpack-plugin":"^4.0.0-alpha.0"},"_npmOperationalInternal":{"tmp":"tmp/color_1.4.0_1783252630015_0.40015451620356","host":"s3://npm-registry-packages-npm-production"}},"1.5.0":{"name":"@basementuniverse/color","version":"1.5.0","author":{"url":"https://gordonlarrigan.com","name":"Gordon Larrigan","email":"gordonlarrigan@gmail.com"},"license":"MIT","_id":"@basementuniverse/color@1.5.0","maintainers":[{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"}],"homepage":"https://github.com/basementuniverse/color#readme","bugs":{"url":"https://github.com/basementuniverse/color/issues"},"dist":{"shasum":"eb32feeb21c11b0f9cf8e97c188570eed8bd4bfa","tarball":"https://registry.npmjs.org/@basementuniverse/color/-/color-1.5.0.tgz","fileCount":5,"integrity":"sha512-RZKDN+OLbWASgLeW1ONm06T9mUGyxIRCgkKXdIHr49CsT5Qm/6Nc1KF+BQ4nLK4Dc+FxBmAS5CxKlmTT+6GS+Q==","signatures":[{"sig":"MEYCIQCOFKW5ZFV0IirsbGtrCRwMnuO3DVrbak4ccnp/fUicZAIhAMEyk98/TUDKfrojldBsl5W5ytTFs9f8eXOzOVKQoWvW","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22455},"main":"build/index.js","types":"build/index.d.ts","gitHead":"a96fe4984f682491356fcea5c64ae0a70aec66d6","scripts":{"test":"qunit","build":"webpack --mode production","watch":"webpack --watch","build:dev":"webpack --mode development"},"_npmUser":{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"},"repository":{"url":"git+https://github.com/basementuniverse/color.git","type":"git"},"_npmVersion":"11.6.2","description":"A small colour utilities library.","directories":{},"_nodeVersion":"24.12.0","dependencies":{"@basementuniverse/utils":"^1.8.1"},"_hasShrinkwrap":false,"devDependencies":{"qunit":"^2.24.2","webpack":"^5.3.2","ts-loader":"^8.0.7","typescript":"^4.9.4","@types/node":"^18.11.12","webpack-cli":"^4.1.0","clean-webpack-plugin":"^4.0.0-alpha.0"},"_npmOperationalInternal":{"tmp":"tmp/color_1.5.0_1786748890748_0.5932264833598893","host":"s3://npm-registry-packages-npm-production"}},"1.6.0":{"name":"@basementuniverse/color","version":"1.6.0","author":{"url":"https://gordonlarrigan.com","name":"Gordon Larrigan","email":"gordonlarrigan@gmail.com"},"license":"MIT","_id":"@basementuniverse/color@1.6.0","maintainers":[{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"}],"homepage":"https://github.com/basementuniverse/color#readme","bugs":{"url":"https://github.com/basementuniverse/color/issues"},"dist":{"shasum":"090cfe0d361fe0c90e892b7118beffab114b7700","tarball":"https://registry.npmjs.org/@basementuniverse/color/-/color-1.6.0.tgz","fileCount":5,"integrity":"sha512-F7RbOYRJwV3SVCMmThxT1igHJEgBISG4gXzVVIQ84pQFX6vZwthqqnL0IKJEdnFpLl9DljtoTOvkFm2sjDy89A==","signatures":[{"sig":"MEQCIBSNzpTeGfxXZ5NX2u7ir9yBWSKpUcQ4/XWlmudIfh94AiA/6lj7vX/0o1kY3kLPMQCqusW/wDBObW4ETwluJywwXQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23240},"main":"build/index.js","types":"build/index.d.ts","gitHead":"d3d8176f61056b55748dd16050e1997d7eca9747","scripts":{"test":"qunit","build":"webpack --mode production","watch":"webpack --watch","build:dev":"webpack --mode development"},"_npmUser":{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"},"repository":{"url":"git+https://github.com/basementuniverse/color.git","type":"git"},"_npmVersion":"11.6.2","description":"A small colour utilities library.","directories":{},"_nodeVersion":"24.12.0","dependencies":{"@basementuniverse/utils":"^1.8.1"},"_hasShrinkwrap":false,"devDependencies":{"qunit":"^2.24.2","webpack":"^5.3.2","ts-loader":"^8.0.7","typescript":"^4.9.4","@types/node":"^18.11.12","webpack-cli":"^4.1.0","clean-webpack-plugin":"^4.0.0-alpha.0"},"_npmOperationalInternal":{"tmp":"tmp/color_1.6.0_1786811574530_0.9769756453370575","host":"s3://npm-registry-packages-npm-production"}},"1.6.1":{"name":"@basementuniverse/color","version":"1.6.1","description":"A small colour utilities library.","author":{"name":"Gordon Larrigan","email":"gordonlarrigan@gmail.com","url":"https://gordonlarrigan.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/basementuniverse/color.git"},"main":"build/index.js","types":"build/index.d.ts","scripts":{"test":"qunit","build":"webpack --mode production","build:dev":"webpack --mode development","watch":"webpack --watch"},"devDependencies":{"@types/node":"^18.11.12","clean-webpack-plugin":"^4.0.0-alpha.0","qunit":"^2.24.2","ts-loader":"^8.0.7","typescript":"^4.9.4","webpack":"^5.3.2","webpack-cli":"^4.1.0"},"dependencies":{"@basementuniverse/utils":"^1.8.1"},"gitHead":"020102856b61a0f88ccb65a738f35045cf61f0e7","_id":"@basementuniverse/color@1.6.1","bugs":{"url":"https://github.com/basementuniverse/color/issues"},"homepage":"https://github.com/basementuniverse/color#readme","_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-XD7SY2qB3XIp9/U5eYUxyDWBe4e51jfaDqwz7aw0TzHlUJHZ5NcIEv+p4liBGanNUSFCcCqwbNdM0a/xbZqKWw==","shasum":"95dc436d1c6ba9aef0b2a7a68ffd25e3341a1480","tarball":"https://registry.npmjs.org/@basementuniverse/color/-/color-1.6.1.tgz","fileCount":5,"unpackedSize":23239,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAbQKd/iyjAt49QfW+zyruioTSbIKoNTh2lMhAd/TTYwAiAv1PKvwnRT32HvjmQ/lD8xVulXkP0SgutEdJ7xlGmbMw=="}]},"_npmUser":{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"},"directories":{},"maintainers":[{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/color_1.6.1_1786898520874_0.5927076065209487"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-13T20:08:58.342Z","modified":"2026-08-16T16:42:01.169Z","1.0.0":"2025-10-13T20:08:58.611Z","1.1.0":"2025-10-13T21:19:41.766Z","1.2.0":"2026-03-14T10:26:07.721Z","1.4.0":"2026-07-05T11:57:10.150Z","1.5.0":"2026-08-14T23:08:10.907Z","1.6.0":"2026-08-15T16:32:54.690Z","1.6.1":"2026-08-16T16:42:01.020Z"},"bugs":{"url":"https://github.com/basementuniverse/color/issues"},"author":{"name":"Gordon Larrigan","email":"gordonlarrigan@gmail.com","url":"https://gordonlarrigan.com"},"license":"MIT","homepage":"https://github.com/basementuniverse/color#readme","repository":{"type":"git","url":"git+https://github.com/basementuniverse/color.git"},"description":"A small colour utilities library.","maintainers":[{"name":"basementuniverse","email":"gordonlarrigan@gmail.com"}],"readme":"# Color\n\nA small color utilities library.\n\n## Installation\n\n```bash\nnpm i @basementuniverse/color\n```\n\nFor direct browser usage, include the UMD build with a script tag:\n\n```html\n<script src=\"build/index.js\"></script>\n```\n\nThe build exposes its exports through the `BasementUniverseColor` browser\nnamespace. It does not add each export directly to `window`.\n\n## Usage\n\n```typescript\nimport { RGBAColor, HSLAColor } from '@basementuniverse/color';\n\nconst myRGBAColor: RGBAColor = { r: 255, g: 0, b: 0, a: 1 }; // Red color in RGBA\nconst myHSLAColor: HSLAColor = { h: 0, s: 100, l: 50, a: 1 }; // Red color in HSLA\n```\n\nWhen using the library directly from a browser script, prefix exports with\n`BasementUniverseColor`:\n\n```html\n<script src=\"build/index.js\"></script>\n<script>\n  const color = BasementUniverseColor.ColorUtils.stringToRGBA('#ff0000');\n</script>\n```\n\n### Type guards\n\n```typescript\nimport { isRGBAColor, isHSLAColor } from '@basementuniverse/color';\n\nif (isRGBAColor(myColor)) {\n  // myColor is RGBAColor\n} else if (isHSLAColor(myColor)) {\n  // myColor is HSLAColor\n}\n```\n\n### Parse a string to a colour object\n\n```typescript\nimport { ColorUtils } from '@basementuniverse/color';\n\nconst rgbaColor = ColorUtils.stringToRGBA('rgba(255, 0, 0, 1)'); // { r: 255, g: 0, b: 0, a: 1 }\nconst hslaColor = ColorUtils.stringToHSLA('hsla(0, 100%, 50%, 1)'); // { h: 0, s: 100, l: 50, a: 1 }\n```\n\nSupported format examples:\n\n```\nred\n#f00\n#ff0000\n#ff0000ff\nrgb(255, 0, 0)\nrgb(100%, 0%, 0%)\nrgba(255, 0, 0, 1)\nrgba(100%, 0%, 0%, 1)\nhsl(0, 100%, 50%)\nhsla(0, 100%, 50%, 1)\n```\n\n### Convert between RGBA and HSLA\n\n```typescript\nimport { ColorUtils } from '@basementuniverse/color';\n\nconst hslaColor = ColorUtils.rgbaToHSLA(myRGBAColor); // Convert RGBA to HSLA\nconst rgbaColor = ColorUtils.hslaToRGBA(myHSLAColor); // Convert HSLA to RGBA\n```\n\n### Convert color object to string\n\n```typescript\nimport { ColorUtils } from '@basementuniverse/color';\n\nconst rgbaString = ColorUtils.rgbaToString(myRGBAColor); // \"rgba(255, 0, 0, 1)\"\nconst hslaString = ColorUtils.hslaToString(myHSLAColor); // \"hsla(0, 100%, 50%, 1)\"\n\n// With options...\nconst hexRgbaString = ColorUtils.rgbaToString(myRGBAColor, { mode: 'hex' }); // \"#ff0000\"\nconst hexRgbaStringWithAlpha = ColorUtils.rgbaToString(myRGBAColor, { mode: 'hex', alpha: true }); // \"#ff0000ff\"\n```\n\nSupported modes: `rgb` | `hsl` | `hex`.\n\n### Manipulate colors\n\n```typescript\nimport { ColorUtils } from '@basementuniverse/color';\n\nconst lighterColor = ColorUtils.lighten(myRGBAColor, 0.1); // Lighten color by 10%\nconst darkerColor = ColorUtils.darken(myRGBAColor, 0.1); // Darken color by 10%\nconst moreSaturatedColor = ColorUtils.saturate(myRGBAColor, 0.1); // Increase saturation by 10%\nconst lessSaturatedColor = ColorUtils.desaturate(myRGBAColor, 0.1); // Decrease saturation by 10%\nconst moreOpaqueColor = ColorUtils.fadeIn(myRGBAColor, 0.1); // Increase opacity by 10%\nconst moreTransparentColor = ColorUtils.fadeOut(myRGBAColor, 0.1); // Decrease opacity by 10%\nconst invertedColor = ColorUtils.invert(myRGBAColor); // Invert color\nconst blendedColor = ColorUtils.blend(myRGBAColor, anotherColor, 0.5); // Blend with another color at 50%\nconst tintedColor = ColorUtils.hue(myRGBAColor, 180); // Change hue by 180 degrees\n```\n\n### Generate random colors\n\n```typescript\nimport { ColorUtils } from '@basementuniverse/color';\n\nconst randomRedTint = ColorUtils.randomRGBA({\n  r: { min: 180, max: 255 },\n  g: { min: 0, max: 90 },\n  b: { min: 0, max: 90 },\n});\n\nconst randomPastel = ColorUtils.randomHSLA({\n  h: { min: 0, max: 360 },\n  s: { min: 20, max: 50 },\n  l: { min: 65, max: 85 },\n});\n\nconst randomGradientColor = ColorUtils.randomGradient(\n  [\n    { r: 255, g: 0, b: 0, a: 1 },\n    { r: 255, g: 255, b: 0, a: 1 },\n    { r: 0, g: 255, b: 0, a: 1 },\n  ],\n  {\n    position: { mean: 0.5, stddev: 0.15 },\n  }\n);\n```\n\nPass `rng: () => number` if you want reproducible output for tests or procedural generation.\n","readmeFilename":"README.md"}