{"_id":"@csstools/postcss-light-dark-function@3.0.9","bugs":{"url":"https://github.com/csstools/postcss-plugins/issues"},"dist":{"shasum":"1c82c48189558e7566758becc1e0cb704629f30e","tarball":"http://registry-npm.ywwl.com/@csstools/postcss-light-dark-function/download/@csstools/postcss-light-dark-function-3.0.9.tgz","fileCount":6,"integrity":"sha512-jy2tctDOiWOFy7kE/r0RUY6R1umMBmHvzeGhyXTC+r4HkpNrW7HzD2wN7l/iYwjhDM1FqCejJfWagY3AhW80Rw==","signatures":[{"sig":"MEUCIDaiOeX80enhhv+L0w0HGx3Vognph4magGabMr2RgygyAiEA2AU9q8r3ia9PkOe0mzgxVMm1ZFm7Bj8DV1rt6iDzpXs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDO2p68/peUuw66Z8rX6Mcd53UbwWRjgDB0TT7U6S0eAgIgA3TC1p4u0z/vsgQqu9zUIUV9YlIrE+n0ZauGIWGIxK0="}],"unpackedSize":12329,"size":4504,"noattachment":false,"key":"/@csstools/postcss-light-dark-function/-/@csstools/postcss-light-dark-function-3.0.9.tgz"},"name":"@csstools/postcss-light-dark-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":"3c2982a404ffccabb4ac2e6e87f5443408b73c17","license":"MIT-0","scripts":{},"version":"3.0.9","_npmUser":{"name":"romainmenke","email":"romainmenke@gmail.com"},"homepage":"https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-light-dark-function#readme","keywords":["color","css","function","light-dark","postcss","postcss-plugin"],"repository":{"url":"git+https://github.com/csstools/postcss-plugins.git","type":"git","directory":"plugins/postcss-light-dark-function"},"_npmVersion":"11.13.0","description":"Use the light-dark() color 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/utilities":"^3.0.0","@csstools/css-tokenizer":"^4.0.3","@csstools/css-parser-algorithms":"^4.0.3","@csstools/postcss-progressive-custom-properties":"^5.1.5"},"_hasShrinkwrap":false,"peerDependencies":{"postcss":"^8.4"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/postcss-light-dark-function_3.0.9_1794919820016_0.21500192299213206"},"readme":"# PostCSS Light Dark 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-light-dark-function --save-dev`\n\n[PostCSS Light Dark Function] lets you use the `light-dark` color function in\nCSS, following the [CSS Color 5 Specification].\n\nRead more about this feature on mdn:\n- define the colors for light and dark with [`light-dark()`](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/light-dark)\n- define which elements support light and/or dark with [`color-scheme`](https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme)\n\nWith both features combined you can mix and match color schemes in a single document, while also respecting the user's preferences.\n\n```css\n.foo {\n\tcolor: light-dark(pink, magenta);\n}\n\n.bar {\n\t--bar: light-dark(cyan, deepskyblue);\n}\n\n/* becomes */\n\n.foo {\n\t--csstools-light-dark-toggle--0: var(--csstools-color-scheme--light) magenta;\n\tcolor: var(--csstools-light-dark-toggle--0, pink);\n\tcolor: light-dark(pink, magenta);\n}\n\n.bar {\n\t--csstools-light-dark-toggle--1: var(--csstools-color-scheme--light) deepskyblue;\n\t--bar: var(--csstools-light-dark-toggle--1, cyan);\n\t@supports not (color: light-dark(tan, tan)) {\n\n\t\t& * {\n\t--csstools-light-dark-toggle--1: var(--csstools-color-scheme--light) deepskyblue;\n\t--bar: var(--csstools-light-dark-toggle--1, cyan);\n\t\t}\n\t}\n}\n\n@supports (color: light-dark(red, red)) {\n.bar {\n\t--bar: light-dark(cyan, deepskyblue);\n}\n}\n```\n\nDeclare that your document supports both light and dark mode:\n\n```css\n:root {\n\tcolor-scheme: light dark;\n}\n\n/* becomes */\n\n:root {\n\t--csstools-color-scheme--light: initial;\n\tcolor-scheme: light dark;\n}@media (prefers-color-scheme: dark) {:root {\n\t--csstools-color-scheme--light:  ;\n}\n}\n```\n\nDynamically alter the supported color scheme for some elements:\n\n```css\n:root {\n\t/* Root only supports light mode */\n\tcolor-scheme: light;\n}\n\n.foo {\n\t/* This element and its children only support dark mode */\n\tcolor-scheme: dark;\n}\n\n/* becomes */\n\n:root {\n\t/* Root only supports light mode */\n\t--csstools-color-scheme--light: initial;\n\tcolor-scheme: light;\n}\n\n.foo {\n\t/* This element and its children only support dark mode */\n\t--csstools-color-scheme--light:  ;\n\tcolor-scheme: dark;\n}\n```\n\n## Usage\n\nAdd [PostCSS Light Dark Function] to your project:\n\n```bash\nnpm install postcss @csstools/postcss-light-dark-function --save-dev\n```\n\nUse it as a [PostCSS] plugin:\n\n```js\nconst postcss = require('postcss');\nconst postcssLightDarkFunction = require('@csstools/postcss-light-dark-function');\n\npostcss([\n\tpostcssLightDarkFunction(/* pluginOptions */)\n]).process(YOUR_CSS /*, processOptions */);\n```\n\n\n\n## Options\n\n### preserve\n\nThe `preserve` option determines whether the original notation\nis preserved. By default, it is preserved.\n\n```js\npostcssLightDarkFunction({ preserve: false })\n```\n\n```css\n.foo {\n\tcolor: light-dark(pink, magenta);\n}\n\n.bar {\n\t--bar: light-dark(cyan, deepskyblue);\n}\n\n/* becomes */\n\n.foo {\n\t--csstools-light-dark-toggle--0: var(--csstools-color-scheme--light) magenta;\n\tcolor: var(--csstools-light-dark-toggle--0, pink);\n}\n\n.bar {\n\t--csstools-light-dark-toggle--1: var(--csstools-color-scheme--light) deepskyblue;\n\t--bar: var(--csstools-light-dark-toggle--1, cyan);\n\t& * {\n\t--csstools-light-dark-toggle--1: var(--csstools-color-scheme--light) deepskyblue;\n\t--bar: var(--csstools-light-dark-toggle--1, cyan);\n\t}\n}\n```\n\n### enableProgressiveCustomProperties\n\nThe `enableProgressiveCustomProperties` option determines whether the original notation\nis wrapped with `@supports` when used in Custom Properties. By default, it is enabled.\n\n> [!NOTE]\n> We only recommend disabling this when you set `preserve` to `false` or if you bring your own fix for Custom Properties.  \n> See what the plugin does in its [README](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties#readme).\n\n```js\npostcssLightDarkFunction({ enableProgressiveCustomProperties: false })\n```\n\n[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test\n[css-url]: https://cssdb.org/#light-dark-function\n[discord]: https://discord.gg/bUadyRwkJS\n[npm-url]: https://www.npmjs.com/package/@csstools/postcss-light-dark-function\n\n[PostCSS]: https://github.com/postcss/postcss\n[PostCSS Light Dark Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-light-dark-function\n[CSS Color 5 Specification]: https://drafts.csswg.org/css-color-5/#light-dark\n","publish_time":1794919820133,"_cnpm_publish_time":1794919820133,"dist-tags":{"latest":"3.0.9"}}