{"name":"@csstools/postcss-light-dark-function","version":"3.0.5","keywords":["postcss-plugin"],"license":"MIT-0","_id":"@csstools/postcss-light-dark-function@3.0.5","maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},{"name":"alaguna","email":"sombragriselros@gmail.com"},{"name":"romainmenke","email":"romainmenke@gmail.com"}],"contributors":[{"url":"https://antonio.laguna.es","name":"Antonio Laguna","email":"antonio@laguna.es"},{"name":"Romain Menke","email":"romainmenke@gmail.com"}],"homepage":"https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-light-dark-function#readme","bugs":{"url":"https://github.com/csstools/postcss-plugins/issues"},"dist":{"shasum":"5d2a6ddc64902e64d82289b5a44e2a37dd076352","tarball":"http://registry-npm.ywwl.com/@csstools/postcss-light-dark-function/download/@csstools/postcss-light-dark-function-3.0.5.tgz","fileCount":6,"integrity":"sha512-kbxAl1yhKYwTPvbJuYRVXfjuokva2DcV3gtiCDhJsIEZwdXQKCjTiFojWAPWIemTmEijryaGcmEoO0vTFmSD5g==","signatures":[{"sig":"MEQCIGvqWUwLpA1riL7mnDVQV+p5dxqnMHbIyB5BxTzA8PsBAiBlslBENDbAgRQtongYKUgJLFbufOXtjo5aHLwlclMI1w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQCOgLIdr6j6NJkwxtCO8ux6rXfbeU9VFhYZ4yfgNe9YrQIgWVzTkTDneaxrk8KJHaELbm60Fz2SiJ1T8QTp3BTxovs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12362,"size":4462,"noattachment":false,"key":"/@csstools/postcss-light-dark-function/-/@csstools/postcss-light-dark-function-3.0.5.tgz"},"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":"62dcac22d8b2f66b5bb0cccb0c59770a26ce1970","scripts":{},"_npmUser":{"name":"romainmenke","email":"romainmenke@gmail.com"},"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":{},"_nodeVersion":"26.1.0","dependencies":{"@csstools/utilities":"^3.0.0","@csstools/css-tokenizer":"^4.0.2","@csstools/css-parser-algorithms":"^4.0.1","@csstools/postcss-progressive-custom-properties":"^5.1.3"},"_hasShrinkwrap":false,"peerDependencies":{"postcss":"^8.4"},"_npmOperationalInternal":{"tmp":"tmp/postcss-light-dark-function_3.0.5_1790347176298_0.02603030119938965","host":"s3://npm-registry-packages-npm-production"},"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":1790347176407,"_cnpm_publish_time":1790347176407,"dist-tags":{"latest":"3.0.9"}}