{"id":19529591,"url":"https://github.com/pacexy/tailwindcss-variable-colors","last_synced_at":"2025-04-26T11:35:24.031Z","repository":{"id":184747394,"uuid":"634164186","full_name":"pacexy/tailwindcss-variable-colors","owner":"pacexy","description":"Add dark mode support with just one class","archived":false,"fork":false,"pushed_at":"2024-05-19T13:11:35.000Z","size":150,"stargazers_count":32,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-20T13:53:45.161Z","etag":null,"topics":["tailwindcss","tailwindcss-plugin"],"latest_commit_sha":null,"homepage":"https://tailwindcss-variable-colors.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pacexy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-04-29T08:49:24.000Z","updated_at":"2024-05-20T09:42:17.000Z","dependencies_parsed_at":"2023-07-30T02:47:04.832Z","dependency_job_id":null,"html_url":"https://github.com/pacexy/tailwindcss-variable-colors","commit_stats":null,"previous_names":["pacexy/tailwindcss-variable-colors"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacexy%2Ftailwindcss-variable-colors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacexy%2Ftailwindcss-variable-colors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacexy%2Ftailwindcss-variable-colors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pacexy%2Ftailwindcss-variable-colors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pacexy","download_url":"https://codeload.github.com/pacexy/tailwindcss-variable-colors/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224034242,"owners_count":17244754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["tailwindcss","tailwindcss-plugin"],"created_at":"2024-11-11T01:26:08.968Z","updated_at":"2024-11-11T01:26:09.773Z","avatar_url":"https://github.com/pacexy.png","language":"TypeScript","readme":"# Tailwindcss Variable Colors\n\nAdd dark mode support with just one class\n\n## Demo\n\n\u003chttps://tailwindcss-variable-colors.vercel.app/\u003e\n\n## Installation\n\n```sh\npnpm i -D tailwindcss-variable-colors\n```\n\n## Usage\n\n```ts\n// tailwind.config.ts\nimport { Config } from 'tailwindcss'\nimport colors from 'tailwindcss/colors'\nimport { createVariableColors, variableColorsPlugin } from 'tailwindcss-variable-colors'\n\nconst config: Config = {\n  content: ['./src/**/*.tsx'],\n  theme: {\n    // You can also not pass the colors parameter,\n    // it will use the colors from tailwindcss by default.\n    colors: createVariableColors(colors),\n  },\n  plugins: [variableColorsPlugin(colors)],\n}\n\nexport default config\n```\n\n```tsx\n// Button.tsx\nconst Button = () =\u003e (\n  \u003cbutton className=\"text-slate-700 bg-slate-100 hover:bg-blue-100 active:bg-blue-200 ...\"\u003e\n    Button\n  \u003c/button\u003e\n)\n```\n\nThat's it!\n\n## Production\n\nTo reduce the css bundle size, you can use [`postcss-prune-var`](https://github.com/tomasklaen/postcss-prune-var) to prune unused css variables.\n\nFirst, install it as a dev dependency\n\n```sh\npnpm i -D postcss-prune-var\n```\n\nThen add it to postcss config\n\n```js\n//postcss.config.js\nmodule.exports = {\n  plugins: {\n    // ...\n    'postcss-prune-var': {},\n  },\n}\n```\n\n## Inspired by\n\n\u003chttps://innei.ren/posts/programming/tailwind-built-in-colors-dark-mode\u003e\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpacexy%2Ftailwindcss-variable-colors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpacexy%2Ftailwindcss-variable-colors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpacexy%2Ftailwindcss-variable-colors/lists"}