{"_id":"@csstools/postcss-random-function@4.0.1","bugs":{"url":"https://github.com/csstools/postcss-plugins/issues"},"dist":{"shasum":"907d17bc328dc8cc49639ceab209212bc2d3076d","tarball":"http://registry-npm.ywwl.com/@csstools/postcss-random-function/download/@csstools/postcss-random-function-4.0.1.tgz","fileCount":6,"integrity":"sha512-N/rVDNiKAbvO8M7YL8cucifQF+qVPQH0sJEASblq4Z88ZKE76a3ywFZImbkmpsEECF1MMcK/sctgfYCRycrtyQ==","signatures":[{"sig":"MEUCIQC82fvsQuF5+IId4sc3PAFDK/GkrrDOMJSig/MQUiZrVwIgXRshIW9q98Cyrp5f4SHy48tRxhYxUZgXt0DcIrm4YEE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDA+PuRP93/QefIG2g27u3ccAamzcxQYdE/QloDteYTOQIgUbzsCAtrnUkOXXlC5+7wwtxMF8SJANe98Z7ANstZUNc="}],"unpackedSize":6735,"size":3051,"noattachment":false,"key":"/@csstools/postcss-random-function/-/@csstools/postcss-random-function-4.0.1.tgz"},"name":"@csstools/postcss-random-function","type":"module","engines":{"node":">=20.19.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"}},"funding":[{"url":"https://github.com/sponsors/csstools","type":"github"},{"url":"https://opencollective.com/csstools","type":"opencollective"}],"gitHead":"d2be61b89806a5beb794fd7373efb0efb902dcdf","license":"MIT-0","scripts":{},"version":"4.0.1","_npmUser":{"name":"romainmenke","email":"romainmenke@gmail.com"},"homepage":"https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-random-function#readme","keywords":["css","postcss-plugin","random"],"repository":{"url":"git+https://github.com/csstools/postcss-plugins.git","type":"git","directory":"plugins/postcss-random-function"},"_npmVersion":"11.13.0","description":"Use the random function in CSS","directories":{},"maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},{"name":"alaguna","email":"sombragriselros@gmail.com"},{"name":"romainmenke","email":"romainmenke@gmail.com"}],"_nodeVersion":"26.1.0","contributors":[{"url":"https://antonio.laguna.es","name":"Antonio Laguna","email":"antonio@laguna.es"},{"name":"Romain Menke","email":"romainmenke@gmail.com"}],"dependencies":{"@csstools/css-calc":"^3.3.0","@csstools/css-tokenizer":"^4.0.0","@csstools/css-parser-algorithms":"^4.0.0"},"_hasShrinkwrap":false,"peerDependencies":{"postcss":"^8.4"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/postcss-random-function_4.0.1_1788708781136_0.4314909276430603"},"readme":"# PostCSS Random Function [<img src=\"https://postcss.github.io/postcss/logo.svg\" alt=\"PostCSS Logo\" width=\"90\" height=\"90\" align=\"right\">][PostCSS]\n\n`npm install @csstools/postcss-random-function --save-dev`\n\n[PostCSS Random Function] lets you use the `random` function, following the [CSS Values 5] specification.\n\n```css\ndiv {\n\tcolor: oklch(0.7 0.2 random(120deg, 240deg));\n}\n\ndiv {\n\tcolor: oklch(0.7 0.2 random(120deg, 240deg, 7deg));\n}\n\ndiv {\n\tmargin: random(10px, 100px) random(10px, 100px);\n\tpadding: random(--padding, 10px, 100px) random(--padding, 10px, 100px);\n}\n\n/* becomes */\n\ndiv {\n\tcolor: oklch(0.7 0.2 166.80407deg);\n}\n\ndiv {\n\tcolor: oklch(0.7 0.2 169deg);\n}\n\ndiv {\n\tmargin: 45.10305px 45.10305px;\n\tpadding: 73.36206px 73.36206px;\n}\n```\n\n> [!NOTE]\n> Generated values are deterministic pseudo random numbers.\n> Generating values twice with the same input will give the same result.\n> The input length of the CSS source file is used as a random seed.\n\n## Usage\n\nAdd [PostCSS Random Function] to your project:\n\n```bash\nnpm install postcss @csstools/postcss-random-function --save-dev\n```\n\nUse it as a [PostCSS] plugin:\n\n```js\nconst postcss = require('postcss');\nconst postcssRandomFunction = require('@csstools/postcss-random-function');\n\npostcss([\n\tpostcssRandomFunction(/* pluginOptions */)\n]).process(YOUR_CSS /*, processOptions */);\n```\n\n\n\n## ⚠️ About custom properties\n\nGiven the dynamic nature of custom properties it's impossible to know what the variable value is, which means the plugin can't compute a final value for the stylesheet. \n\nBecause of that, any usage that contains a `var` is skipped.\n\n## Options\n\n### preserve\n\nThe `preserve` option determines whether the original notation\nis preserved. By default, it is not preserved.\n\n```js\npostcssRandomFunction({ preserve: true })\n```\n\n```css\ndiv {\n\tcolor: oklch(0.7 0.2 random(120deg, 240deg));\n}\n\ndiv {\n\tcolor: oklch(0.7 0.2 random(120deg, 240deg, 7deg));\n}\n\ndiv {\n\tmargin: random(10px, 100px) random(10px, 100px);\n\tpadding: random(--padding, 10px, 100px) random(--padding, 10px, 100px);\n}\n\n/* becomes */\n\ndiv {\n\tcolor: oklch(0.7 0.2 166.80407deg);\n\tcolor: oklch(0.7 0.2 random(120deg, 240deg));\n}\n\ndiv {\n\tcolor: oklch(0.7 0.2 169deg);\n\tcolor: oklch(0.7 0.2 random(120deg, 240deg, 7deg));\n}\n\ndiv {\n\tmargin: 45.10305px 45.10305px;\n\tmargin: random(10px, 100px) random(10px, 100px);\n\tpadding: 73.36206px 73.36206px;\n\tpadding: random(--padding, 10px, 100px) random(--padding, 10px, 100px);\n}\n```\n\n[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test\n[css-url]: https://cssdb.org/#random-function\n[discord]: https://discord.gg/bUadyRwkJS\n[npm-url]: https://www.npmjs.com/package/@csstools/postcss-random-function\n\n[PostCSS]: https://github.com/postcss/postcss\n[PostCSS Random Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-random-function\n[CSS Values 5]: https://drafts.csswg.org/css-values-5/#random\n","publish_time":1788708781218,"_cnpm_publish_time":1788708781218,"dist-tags":{"latest":"4.0.6"}}