{"id":19020359,"url":"https://github.com/ambar/postcss-theme-colors","last_synced_at":"2025-04-23T05:43:54.964Z","repository":{"id":37663791,"uuid":"119270233","full_name":"ambar/postcss-theme-colors","owner":"ambar","description":"Use relative color syntax or color-mix() with theme color groups 😉","archived":false,"fork":false,"pushed_at":"2024-05-02T02:03:09.000Z","size":138,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-17T20:40:26.896Z","etag":null,"topics":["css","postcss","postcss-plugin","theme","theming"],"latest_commit_sha":null,"homepage":"","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/ambar.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-01-28T15:25:25.000Z","updated_at":"2024-05-15T19:19:57.000Z","dependencies_parsed_at":"2024-04-22T03:25:13.414Z","dependency_job_id":"188b31ba-6454-4d9e-942d-4ea916930006","html_url":"https://github.com/ambar/postcss-theme-colors","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambar%2Fpostcss-theme-colors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambar%2Fpostcss-theme-colors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambar%2Fpostcss-theme-colors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambar%2Fpostcss-theme-colors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ambar","download_url":"https://codeload.github.com/ambar/postcss-theme-colors/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250379778,"owners_count":21420841,"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":["css","postcss","postcss-plugin","theme","theming"],"created_at":"2024-11-08T20:16:57.547Z","updated_at":"2025-04-23T05:43:54.922Z","avatar_url":"https://github.com/ambar.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postcss-theme-colors\n\n[![test workflow](https://github.com/ambar/postcss-theme-colors/actions/workflows/test.yml/badge.svg)](https://github.com/ambar/postcss-theme-colors/actions/workflows/test.yml)\n[![Coverage Status](https://coveralls.io/repos/github/ambar/postcss-theme-colors/badge.svg?branch=main)](https://coveralls.io/github/ambar/postcss-theme-colors?branch=main)\n\nExpand theme color groups to allow non-static handling of relative color syntax or `color-mix()` function.\n\n## Installation\n\n```bash\nnpm install postcss-theme-colors postcss-preset-env\n```\n\n## Usage\n\nInput:\n\n```css\na {\n  /* any value with theme (light/dark) color */\n  color: oklch(from var(--G01) l c h / 0.1);\n  /* more:\n  border: 1px solid oklch(from var(--G01) .8 c h);\n  box-shadow: 0 0 0 2px var(--G01), 0 0 0 4px oklch(from var(--G01) l c h / .1);\n  --anyVar: value-with-theme-color;\n  */\n}\n```\n\nOutput:\n\n```css\na {\n  --v1868641404: var(--flag-light, rgba(238, 238, 238, 0.1)) var(--flag-dark, rgba(17, 17, 17, 0.1));\n  color: rgba(238, 238, 238, 0.1); /* fallback */\n  color: var(--v1868641404); /* expand for color scheme */\n}\n\n@supports (color: lab(from red l 1 1% / calc(alpha + 0.1))) {\n  a {\n    color: oklch(from var(--G01) l c h / 0.1); /* W3C */\n  }\n}\n```\n\n## Configuration\n\n```js\nconst colors = {\n  '--G01': ['#eee', '#111'],\n}\n\npostcss([\n  require('postcss-theme-colors')({colors}),\n  require('postcss-preset-env'),\n  require('@csstools/postcss-global-data')({\n    files: [\n      // example flags\n      require.resolve('postcss-theme-colors/flag.css'),\n      // your global theme colors\n      'vars.css',\n    ],\n  }),\n]).process(css)\n```\n\n### Plugin Options\n\n```ts\ntype Options = {\n  /** color groups */\n  colors: Record\u003cstring, string | string[]\u003e\n  /**\n   * boolean flags\n   * @default ['--flag-light', '--flag-dark']\n   */\n  flags?: string[]\n  /**\n   * Whether to inject boolean flags, could also be defined in global CSS files\n   * @default false\n   */\n  shouldInjectFlags?: boolean\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fambar%2Fpostcss-theme-colors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fambar%2Fpostcss-theme-colors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fambar%2Fpostcss-theme-colors/lists"}