{"_id":"@axub/tw-colors","_rev":"2-9bb1f8cd908ca9e6fa7692462535d1a4","name":"@axub/tw-colors","dist-tags":{"latest":"1.2.8"},"versions":{"1.2.6":{"name":"@axub/tw-colors","version":"1.2.6","author":{"name":"Laurent Blondy","email":"laurent.blondy1@gmail.com","url":"https://blondy.dev/"},"description":"Tailwind plugin for switching color theme with just one className","keywords":["tailwind","tailwindcss","color","colors","theme","themes","dark"],"main":"dist/lib/index.js","module":"dist/lib/index.mjs","types":"dist/lib/index.d.ts","scripts":{"build":"tsup","prepublish":"git pull && npm run build && vitest run","postpublish":"git add . && git commit -a && git tag v$npm_package_version && git push --tags && git push","test":"npm run build && vitest","demo":"npm run build && vite","yes":"echo $npm_package_version"},"publishConfig":{"access":"public","branches":["master"]},"peerDependencies":{"tailwindcss":">=3.0.0"},"dependencies":{"color":"^4.2.3","flat":"^5.0.2","lodash.foreach":"^4.5.0"},"devDependencies":{"@types/color":"^3.0.3","@types/flat":"^5.0.2","@types/lodash.foreach":"^4.5.7","@types/node":"^18.11.9","autoprefixer":"^10.4.13","postcss":"^8.4.21","prettier":"^2.7.1","tsup":"^6.7.0","typescript":">=4.0.0","vite":"^4.0.4","vitest":"^0.28.3"},"repository":{"type":"git","url":"git+https://github.com/AXub/tw-colors.git"},"license":"MIT","gitHead":"7cff8e995538bfab1c2f674142e7b91ad8ba5d40","bugs":{"url":"https://github.com/AXub/tw-colors/issues"},"homepage":"https://github.com/AXub/tw-colors#readme","_id":"@axub/tw-colors@1.2.6","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-IXZ0UerPO2SXQlQkmU6l6iw/3TtS0N6dCbgecia+0AcipN6R/G1YUEzWFQLEgtBqvdddIgwyihPsneJEnCI7HQ==","shasum":"08ea1f94465595456520ecfbffc70b79bc0cf582","tarball":"https://registry.npmjs.org/@axub/tw-colors/-/tw-colors-1.2.6.tgz","fileCount":18,"unpackedSize":30374,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD2cbGpJLnXyd7tvR7S6mQNEK7UjfSoQDv7144swnVHyAIhAP9RShzygsjSXGx0KKqcHtCK8HA/gAFWesc6EpE1f8e6"}]},"_npmUser":{"name":"axub","email":"xubulovaa@yandex.ru"},"directories":{},"maintainers":[{"name":"axub","email":"xubulovaa@yandex.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tw-colors_1.2.6_1687522037379_0.46321141602777116"},"_hasShrinkwrap":false},"1.2.7":{"name":"@axub/tw-colors","version":"1.2.7","author":{"name":"Laurent Blondy","email":"laurent.blondy1@gmail.com","url":"https://blondy.dev/"},"description":"Tailwind plugin for switching color theme with just one className","keywords":["tailwind","tailwindcss","color","colors","theme","themes","dark"],"main":"dist/lib/index.js","module":"dist/lib/index.mjs","types":"dist/lib/index.d.ts","scripts":{"build":"tsup","prepublish":"git pull && npm run build && vitest run","postpublish":"git add . && git commit -a && git tag v$npm_package_version && git push --tags && git push","test":"npm run build && vitest","demo":"npm run build && vite","yes":"echo $npm_package_version"},"publishConfig":{"access":"public","branches":["master"]},"peerDependencies":{"tailwindcss":">=3.0.0"},"dependencies":{"color":"^4.2.3","flat":"^5.0.2","lodash.foreach":"^4.5.0"},"devDependencies":{"@types/color":"^3.0.3","@types/flat":"^5.0.2","@types/lodash.foreach":"^4.5.7","@types/node":"^18.11.9","autoprefixer":"^10.4.13","postcss":"^8.4.21","prettier":"^2.7.1","tsup":"^6.7.0","typescript":">=4.0.0","vite":"^4.0.4","vitest":"^0.28.3"},"repository":{"type":"git","url":"git+https://github.com/AXub/tw-colors.git"},"license":"MIT","gitHead":"2a47f65eabf558003ed3db80960922f4d69ef036","bugs":{"url":"https://github.com/AXub/tw-colors/issues"},"homepage":"https://github.com/AXub/tw-colors#readme","_id":"@axub/tw-colors@1.2.7","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-kXnG2bg9e5jkuRUQKY8VuBTgxM80VE/XbNlO51vO17QVFIL/PjqJS5unkt4/Xump05n//lovD4zpUXqdohkucg==","shasum":"1ecedf38791a5f131588c65f086f7e4d609f06bb","tarball":"https://registry.npmjs.org/@axub/tw-colors/-/tw-colors-1.2.7.tgz","fileCount":18,"unpackedSize":30374,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCinBX75ysrefCydcFGyPmPCHzV9cGMYKRI2x9A0mrPIQIgNI18GLGty4MCIggVzo+CSV8Ut/rzuXuH/jDYSI8QLGM="}]},"_npmUser":{"name":"axub","email":"xubulovaa@yandex.ru"},"directories":{},"maintainers":[{"name":"axub","email":"xubulovaa@yandex.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tw-colors_1.2.7_1687522096508_0.3337803354088382"},"_hasShrinkwrap":false},"1.2.8":{"name":"@axub/tw-colors","version":"1.2.8","author":{"name":"Laurent Blondy","email":"laurent.blondy1@gmail.com","url":"https://blondy.dev/"},"description":"Tailwind plugin for switching color theme with just one className","keywords":["tailwind","tailwindcss","color","colors","theme","themes","dark"],"main":"dist/lib/index.js","module":"dist/lib/index.mjs","types":"dist/lib/index.d.ts","scripts":{"build":"tsup","test":"npm run build && vitest","demo":"npm run build && vite","yes":"echo $npm_package_version"},"publishConfig":{"access":"public","branches":["master"]},"peerDependencies":{"tailwindcss":">=3.0.0"},"dependencies":{"color":"^4.2.3","flat":"^5.0.2","lodash.foreach":"^4.5.0"},"devDependencies":{"@types/color":"^3.0.3","@types/flat":"^5.0.2","@types/lodash.foreach":"^4.5.7","@types/node":"^18.11.9","autoprefixer":"^10.4.13","postcss":"^8.4.21","prettier":"^2.7.1","tsup":"^6.7.0","typescript":">=4.0.0","vite":"^4.0.4","vitest":"^0.28.3"},"repository":{"type":"git","url":"git+https://github.com/AXub/tw-colors.git"},"license":"MIT","gitHead":"2bdeb83d817e1f792fc32e39fbee16181bfd0fae","bugs":{"url":"https://github.com/AXub/tw-colors/issues"},"homepage":"https://github.com/AXub/tw-colors#readme","_id":"@axub/tw-colors@1.2.8","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-aSfDkZyU0WD4V8KwgFj8x3DO9hVKsFpIUp9CTPwjXIR9A/bN3r2TCxeL1qU67CPVczYwKBXK4PVo8Hnp3CJYtA==","shasum":"81ed1d645a4e39f0c2a123d27e0fcb72f4cf127e","tarball":"https://registry.npmjs.org/@axub/tw-colors/-/tw-colors-1.2.8.tgz","fileCount":23,"unpackedSize":56548,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDMrlYYWo9OYMgHmOHZ5Fe3Dx599HqBFP7XKMt5ia4jCAIgYE4wm5B4q74vTVs5/a/E3X4EWHWBDSfPAbu7qRl/brM="}]},"_npmUser":{"name":"axub","email":"xubulovaa@yandex.ru"},"directories":{},"maintainers":[{"name":"axub","email":"xubulovaa@yandex.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tw-colors_1.2.8_1687522333593_0.4918758576604907"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-23T12:07:17.328Z","1.2.6":"2023-06-23T12:07:17.559Z","modified":"2023-06-23T12:12:13.917Z","1.2.7":"2023-06-23T12:08:16.676Z","1.2.8":"2023-06-23T12:12:13.811Z"},"maintainers":[{"name":"axub","email":"xubulovaa@yandex.ru"}],"description":"Tailwind plugin for switching color theme with just one className","homepage":"https://github.com/AXub/tw-colors#readme","keywords":["tailwind","tailwindcss","color","colors","theme","themes","dark"],"repository":{"type":"git","url":"git+https://github.com/AXub/tw-colors.git"},"author":{"name":"Laurent Blondy","email":"laurent.blondy1@gmail.com","url":"https://blondy.dev/"},"bugs":{"url":"https://github.com/AXub/tw-colors/issues"},"license":"MIT","readme":"# Welcome to [tw-colors](https://github.com/L-Blondy/tw-colors)\n\nIntroducing the ultimate game-changer for your Tailwind app! Say goodbye to cluttered dark variants and messy CSS variables. With this tailwind plugin, switching between color themes is as effortless as changing one className. Elevate your design game and add a touch of vibrant color to your app today!\n\n## Highlights\n\n* 🚀 **No markup change required**,  no need to refactor your existing code.\n* 📦 **Zero javascript** added to the bundle size, it's just some CSS!\n* ✨ **All color formats** are supported, including HEX, RGB, HSL, and named colors\n* 🤩 **Fine-grained theming** with variants\n* 💫 **Full [Tailwind CSS Intellisense][tailwind-intellisense-url] support** 🔥🔥🔥\n \n\n## The Gist\n\n```bash\nnpm i -D tw-colors\n```\n\nTake an existing tailwind config and move the colors in the `createTheme` plugin, giving it a name (e.g. light).\n\n*tailwind.config.js*\n```diff\n+  const { createThemes } = require('tw-colors');\n\n   module.exports = {\n      content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],\n      theme: {\n         extends: {\n-           colors: {\n-              'primary': 'steelblue',\n-              'secondary': 'darkblue',\n-              'brand': '#F3F3F3',\n-           }\n         },\n      },\n      plugins: [\n+        createThemes({\n+           light: { \n+              'primary': 'steelblue',\n+              'secondary': 'darkblue',\n+              'brand': '#F3F3F3',\n+           }\n+        })\n      ],\n   };\n\n```\n\nApply the `theme-light` class anywhere in your app. \\\nAlternatively you can use data attributes `data-theme=\"light\"`\n\n```diff\n-  <html>\n+  <html class='theme-light'>\n      ...\n      <div class='bg-brand'>\n         <h1 class='text-primary'>...</h1>\n         <p class='text-secondary'>...</p>\n      </div>\n      ...\n   </html>\n```\n\nThat's it, you site has a light theme!\n\n## Usage\n\n### Add multiple themes\n\nInside the `createThemes` function, define multiple color themes that use the same color names.\n\n*tailwind.config.js*\n```diff\n   const { createThemes } = require('tw-colors');\n\n   module.exports = {\n      content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],\n      plugins: [\n         createThemes({\n            light: { \n               'primary': 'steelblue',\n               'secondary': 'darkblue',\n               'brand': '#F3F3F3',\n            },\n+           dark: { \n+              'primary': 'turquoise',\n+              'secondary': 'tomato',\n+              'brand': '#4A4A4A',\n+           },\n+           forest: { \n+              'primary': '#2A9D8F',\n+              'secondary': '#E9C46A',\n+              'brand': '#264653',\n+           },\n         })\n      ],\n   };\n```\n\n### Switching themes\n\nSimply switch the className.\n\n```diff\n-  <html class='theme-light'>\n+  <html class='theme-dark'>\n      ...\n   </html>\n```\n\n...or the *data-theme* attribute\n\n```diff\n-  <html data-theme='light'>\n+  <html data-theme='dark'>\n      ...\n   </html>\n```\n\n## Advanced usage\n\n### Nested themes\n\n```diff\n   <html class='theme-dark'>\n      ...\n      <div class='theme-light'>\n         ...\n      </div>\n\n      <div class='theme-forest'>\n         ...\n      </div>\n   </html>\n```\n\n###  Variants\n\nBased on the current themes, specific styles can be applied with variants\n\n```html\n   <!-- Use \"serif\" font for the dark theme, \"sans\" font for all other themes -->\n\n   <div class='theme-dark font-sans theme-dark:font-serif'>\n      ...\n      <div>Serif font here</div>\n   </div>\n\n   <div class='theme-light font-sans theme-dark:font-serif'>\n      ...\n      <div>Sans font here</div>\n   </div>\n```\n\nVariants only work alongside theme declarations\n\n❌ Does not work\n\n```html\n   <html class='theme-dark font-sans'>\n      ...\n      <div class='theme-dark:font-serif'>\n         ❌ Sans font here\n      </div>\n   </html>\n```\n\n\n✅ Works fine\n\n```html\n   <html class='theme-dark font-sans theme-dark:font-serif'>\n      ...\n      <div>\n         ✅ Serif font here\n      </div>\n   </html>\n```\n\n*Note: this feature might be added in future versions based on community feedback*\n\n<details>\n   <summary>\n         <strong> Caveats: inherited properties </strong>\n   </summary>\n\n   Inherited properties (e.g. \"font-family\") are inherited by **all descendants**, including nested themes.\n   In order to stop the propagation the base styles should be re-declared on nested themes\n\n   ❌ Unexpected behavior\n\n   ```html\n      <html class='theme-dark font-sans theme-dark:font-serif'>\n         ...\n         <div>\n            ✅ Serif is active\n         </div>\n\n         <div class=\"theme-light\">\n            ❌ Serif is still active, it got inherited from the parent theme\n         </div>     \n      </html>\n   ```\n\n   ✅ Works as expected\n\n   ```html\n      <html class='theme-dark font-sans theme-dark:font-serif'>\n         ...\n         <div>\n            ✅ Serif is active\n         </div>\n\n         <div class=\"theme-light font-sans theme-dark:font-serif\">\n            ✅ Sans is active\n         </div>   \n      </html>\n   ```\n</details>\n\n### CSS color-scheme\n\n`createThemes` also accepts a function that exposes the `light` and `dark` functions. \\\nTo apply the `color-scheme` CSS property, simply wrap your themes with `light` or `dark`.\"\n\n*tailwind.config.js*\n```js\n   const { createThemes } = require('tw-colors');\n\n   module.exports = {\n      // ...your tailwind config\n      plugins: [\n         createThemes(({ light, dark }) => ({\n            'my-light-theme': light({ \n               'primary': 'steelblue',\n               'secondary': 'darkblue',\n               'brand': '#F3F3F3',\n            }),\n            'my-dark-theme': dark({ \n               'primary': 'turquoise',\n               'secondary': 'tomato',\n               'brand': '#4A4A4A',\n            }),\n         }))\n      ],\n   };\n```\n\nSee the [MDN docs][mdn-color-scheme] for more details on this feature.\n\n### CSS Variables\n\n**tw-colors** creates CSS variables using the format `--twc-[color name]` by default, they contain HSL values. \n\nFor example, with the following configuration, the variables `--twc-primary`, `--twc-secondary`, `--twc-brand` will be created.\n\n*tailwind.config.js*\n```js\n   module.exports = {\n      // ...your tailwind config\n      plugins: [\n         createThemes({\n            'my-light-theme': { \n               'primary': 'steelblue',\n               'secondary': 'darkblue',\n               'brand': '#F3F3F3',\n            },\n            'my-dark-theme': { \n               'primary': 'turquoise',\n               'secondary': 'tomato',\n               'brand': '#4A4A4A',\n            },\n         })\n      ],\n   };\n```\n\nExample usage:\n\n```css \n.my-class {\n   color: hsl(var(--twc-primary));\n   background: hsl(var(--twc-primary) / 0.5);\n}\n```\n\n<details>\n<summary><b>Custom CSS Variables</b></summary><br/>\n\nThe CSS variables names can be **customized** by passing some options as `createThemes` **2nd argument**.\n\nThe available options are: \n* **cssVariablePrefix**, default: `'twc-'`\n* **cssVariableSuffix**, default: `''`\n\nWith the following configuration, the variables `--prefix-primary-suffix`, `--prefix-secondary-suffix`, `--prefix-brand-suffix` will be created.\n\n*tailwind.config.js*\n```js\n   module.exports = {\n      // ...your tailwind config\n      plugins: [\n         createThemes({\n            'my-light-theme': { \n               'primary': 'steelblue',\n               'secondary': 'darkblue',\n               'brand': '#F3F3F3',\n            },\n            'my-dark-theme': { \n               'primary': 'turquoise',\n               'secondary': 'tomato',\n               'brand': '#4A4A4A',\n            },\n         }, {\n            cssVariablePrefix: 'prefix-', \n            cssVariableSuffix: '-suffix' \n         })\n      ],\n   };\n```\n</details>\n\n<div align=\"center\">\n\nPlease share\n\n[![][tweet]][tweet-url]\n\n</div >\n\n[tweet]: https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fgithub.com%2Fsaadeghi%2Fdaisyui\n[tweet-url]: https://twitter.com/intent/tweet?text=tw-colors%0ATailwind%20color%20themes%20made%20easy!%0Ahttps://github.com/L-Blondy/tw-colors\n[tailwind-intellisense-url]: https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss\n[mdn-color-scheme]: https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme\n<!-- https://github.com/L-Blondy/tw-colors/blob/master/README.md -->","readmeFilename":"README.md"}