{"_id":"@automuxer/webgl-color-utils","_rev":"2-276bfce3fcad94f8cc3bf6e175bc4d93","name":"@automuxer/webgl-color-utils","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@automuxer/webgl-color-utils","version":"0.1.0","keywords":["colors","hex","rgb","webgl"],"author":{"name":"reesericci"},"license":"AGPL-3.0-or-later","_id":"@automuxer/webgl-color-utils@0.1.0","maintainers":[{"name":"reesericci","email":"me@reeseric.ci"}],"dist":{"shasum":"c344b226f15101e47fd87ee7b6c8afd67ab9bca1","tarball":"https://registry.npmjs.org/@automuxer/webgl-color-utils/-/webgl-color-utils-0.1.0.tgz","fileCount":5,"integrity":"sha512-U4RpCJJCuGJhtxJL55ABa57l8cauL4wZIYwmuw6W72Sv3IYiBF9ovuic/KsonokXU4ZghI0YtkaWKYfkRRUc4g==","signatures":[{"sig":"MEYCIQDJLocoEfijCehjeF93ebtgNTTu/36R/H1t7cfUAwjjuQIhAOZFZrnHW+6XLb+W+XPR2nNwec8Zb0weQPY1FYbN2Jtk","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":38231},"main":"dist/index.js","type":"module","scripts":{"build":"tsdown"},"typings":"dist/index.d.mts","_npmUser":{"name":"reesericci","email":"me@reeseric.ci"},"_npmVersion":"11.11.0","description":"WebGL friendly colors","directories":{},"_nodeVersion":"24.14.1","dependencies":{"hex-rgb":"^4.2.0","rgb-hex":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tsdown":"^0.22.3","typescript":"^6.0.3"},"_npmOperationalInternal":{"tmp":"tmp/webgl-color-utils_0.1.0_1783113613289_0.020370836357584743","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@automuxer/webgl-color-utils","author":{"name":"reesericci"},"version":"0.1.1","type":"module","description":"WebGL friendly colors","keywords":["colors","hex","rgb","webgl"],"license":"AGPL-3.0-or-later","main":"dist/index.mjs","module":"dist/index.mjs","types":"dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"}},"scripts":{"build":"tsdown"},"dependencies":{"hex-rgb":"^5.0.0","rgb-hex":"^4.1.0"},"devDependencies":{"tsdown":"^0.22.3","typescript":"^6.0.3"},"_id":"@automuxer/webgl-color-utils@0.1.1","_nodeVersion":"24.14.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-5zf/7XC4DsYvgAIUtbsAZ15u3RBMRWmt2urUNxDb0M1s276gsZwBJF0rpirc6beB1DOu/ZFUBfmALtoZSkRCdA==","shasum":"de2f51339a9a0195184754567c2d5fd2dc67d83c","tarball":"https://registry.npmjs.org/@automuxer/webgl-color-utils/-/webgl-color-utils-0.1.1.tgz","fileCount":5,"unpackedSize":38369,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCNRHaeEglSsdWq6RtRjbY1EBIwf1cL2KkgIgeKn5QVZAIhAILLKN2trJuSUjyx8vOKyoNSTrftXclANgYueR1p85Vl"}]},"_npmUser":{"name":"reesericci","email":"me@reeseric.ci"},"directories":{},"maintainers":[{"name":"reesericci","email":"me@reeseric.ci"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/webgl-color-utils_0.1.1_1783116321552_0.18370092805739135"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-03T21:20:13.157Z","modified":"2026-07-03T22:05:21.857Z","0.1.0":"2026-07-03T21:20:13.459Z","0.1.1":"2026-07-03T22:05:21.741Z"},"author":{"name":"reesericci"},"license":"AGPL-3.0-or-later","keywords":["colors","hex","rgb","webgl"],"description":"WebGL friendly colors","maintainers":[{"name":"reesericci","email":"me@reeseric.ci"}],"readme":"## `@automuxer/webgl-color-utils`\n\nUtility functions for converting colors to WebGL friendly formats, forked from `@automuxer/webgl-color-utils`, sans react dependencies.\n\n##### Install via npm:\n```js\nnpm install @automuxer/webgl-color-utils\n```\n\n##### Importing:\n\n```js\nimport {\n  useHex,\n  convertHex,\n  useRgb,\n  convertRgb,\n} from '@automuxer/webgl-color-utils'\n```\n\n#### `convertHex(hex, noAlpha?)` => `Array`\n\nConvert hex colors to WebGL friendly format. \n\n###### Arguments:\n\n`hex`: String hex color.\n\n`noAlpha (optional)`: Boolean indicating if you want the alpha value in the array.\n\n###### Returns:\n\n`array`: An array of numbers between 0 and 1.  A four element array by default and three elements if the `noAlpha` parameter is used.\n\n###### Example Usage:\n\n```js\nimport {\n  convertHex\n} from '@automuxer/webgl-color-utils'\n\nconst [r, g, b, a] = useHex('#fff')\n// [1, 1, 1, 1]\n\nconst clearColor = useHex('#0006')\n// [0, 0, 0, 0.4]\n\nconvertHex('#4183c4')\n// [0.2549019607843137, 0.5137254901960784, 0.7686274509803922, 1]\n\nconvertHex('#4183c4', true) // Drop the alpha by passing true as a second param \n// [0.2549019607843137, 0.5137254901960784, 0.7686274509803922]\n\ngl.clearColor(...convertHex('#323334'))\n```\n\n#### `convertRgb(rgb, noAlpha?)` => `Array`\n\nConvert rgb colors to WebGL friendly format.\n\n###### Arguments:\n\n`rgb`: String rgb color e.g. `'rgb(40, 42, 54)'` or `'rgba(40, 42, 54, 75%)'`.\n\n`noAlpha (optional)`: Boolean indicating if you want the alpha value in the array.\n\n###### Returns:\n\n`array`: An array of numbers between 0 and 1.  A four element array by default and three elements if the `noAlpha` parameter is used.\n\n###### Example Usage:\n\n```js\nimport {\n  convertRgb,\n} from '@automuxer/webgl-color-utils'\n\nconst [r, g, b, a] = useRgb('rgb(255, 255, 255)');\n// [1, 1, 1, 1]\n\nconst clearColor = convertRgb('rgb(255, 0, 255)', true)\n// [1, 0, 1]\n```\n\n## License\n\n@automuxer/webgl-color-utils\n<br/>Copyright (C) 2026 Software Freedom Conservancy\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU Affero General Public License as\npublished by the Free Software Foundation, either version 3 of the\nLicense, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License\nalong with this program.  If not, see <https://www.gnu.org/licenses/>.\n","readmeFilename":"README.md"}