{"id":29220040,"url":"https://github.com/nicolassutter/unocss-custom-properties","last_synced_at":"2025-07-03T02:08:12.215Z","repository":{"id":218368733,"uuid":"746250999","full_name":"nicolassutter/unocss-custom-properties","owner":"nicolassutter","description":"Generate CSS custom properties from your Uno CSS theme.","archived":false,"fork":false,"pushed_at":"2024-07-08T12:57:38.000Z","size":235,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-01T03:54:00.170Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/unocss-custom-properties","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/nicolassutter.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-01-21T14:21:43.000Z","updated_at":"2024-07-08T12:58:17.000Z","dependencies_parsed_at":"2024-01-21T15:13:07.414Z","dependency_job_id":"c94d717a-973b-4440-8991-db887989e30a","html_url":"https://github.com/nicolassutter/unocss-custom-properties","commit_stats":null,"previous_names":["nicolassutter/unocss-custom-properties"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/nicolassutter/unocss-custom-properties","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolassutter%2Funocss-custom-properties","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolassutter%2Funocss-custom-properties/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolassutter%2Funocss-custom-properties/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolassutter%2Funocss-custom-properties/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nicolassutter","download_url":"https://codeload.github.com/nicolassutter/unocss-custom-properties/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nicolassutter%2Funocss-custom-properties/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263245310,"owners_count":23436515,"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":[],"created_at":"2025-07-03T02:08:11.711Z","updated_at":"2025-07-03T02:08:12.199Z","avatar_url":"https://github.com/nicolassutter.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unocss-custom-properties\r\n\r\nGenerate CSS custom properties from your [Uno CSS](https://unocss.dev/) theme.\r\n\r\n## Install\r\n\r\n```bash\r\nnpm i -D unocss-custom-properties\r\n# pnpm add -D unocss-custom-properties\r\n```\r\n\r\n## Usage\r\n\r\n```ts\r\nimport { defineConfig } from 'unocss'\r\nimport customProperties from 'unocss-custom-properties'\r\n\r\nexport default defineConfig({\r\n  theme: {\r\n    // ... theme values\r\n  },\r\n  presets: [\r\n    customProperties({\r\n      /* options */\r\n    }),\r\n  ],\r\n})\r\n```\r\n\r\n## Options\r\n\r\nBy default, the custom properties will be generated in the `:root` selector and added to the Uno CSS `default` layer.\r\n\r\n| name         | type     | default     | description                                                                                                                                      |\r\n| ------------ | -------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |\r\n| writeFile    | boolean  | `false`     | If the generated CSS should be written to a file                                                                                                 |\r\n| filePath     | string   | `undefined` | The absolute path of the file to write to, if `writeFile` is set to `true`                                                                       |\r\n| inject       | boolean  | `true`      | If the custom properties should be injected to the Uno CSS `default` layer                                                                       |\r\n| prefix       | string   | `''`        | The prefix to use for the custom properties                                                                                                      |\r\n| generateOnly | string[] | `undefined` | If specified, only the corresponding theme keys will be generated as custom properties. This should be an Array of keys available in the `theme` |\r\n| theme | 'user' \\| 'default' | `undefined` | Used to specify which `theme` object to use, either the user specified theme or the whole theme (`default`) including the other presets |\r\n\r\n## Supported properties\r\n\r\nAnything listed in the Uno CSS theme object can generate custom properties as long as `theme[property]` is a valid record.\r\n\r\n⚠️ If the theme is invalid, custom properties will not be generated.\r\n\r\n```ts\r\n// uno.config.ts\r\n\r\nexport default defineConfig({\r\n  theme: {\r\n    spacing: {\r\n      1: '0.25rem'\r\n      2: '0.5rem'\r\n    }, // works, this is a valid object\r\n    colors: {\r\n      gray: {\r\n        100: '#f7fafc',\r\n      }\r\n      blue: 'blue'\r\n    }, // works, this is a valid object\r\n    lineHeight: false // will not work, this needs to be a object\r\n  }\r\n})\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolassutter%2Funocss-custom-properties","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnicolassutter%2Funocss-custom-properties","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnicolassutter%2Funocss-custom-properties/lists"}