# postcss-v-color

> PostCSS plugin for creating color variables

Latest version **0.0.0** (published 2022-03-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-v-color
pnpm add postcss-v-color
yarn add postcss-v-color
bun add postcss-v-color
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.0 |
| Published | 2022-03-24 |
| First published | 2022-03-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12.0.0 |
| Dependencies | 1 |
| Unpacked size | 8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | gradywoodruff |
| Maintainers | gradywoodruff |
| Keywords | postcss, css, postcss-plugin, postcss-v-color |

## Links

- npm: https://www.npmjs.com/package/postcss-v-color
- Repository: https://github.com/gradywoodruff/postcss-v-color
- Homepage: https://github.com/gradywoodruff/postcss-v-color#readme
- Issues: https://github.com/gradywoodruff/postcss-v-color/issues
- npm.io page: https://npm.io/package/postcss-v-color

## Dependencies (1)

- [postcss-value-parser](https://npm.io/package/postcss-value-parser.md) ^4.2.0

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 0.0.0 (latest) — 2022-03-24

## README

# postcss-v-color

[PostCSS] plugin for creating color variables.

[PostCSS]: https://github.com/postcss/postcss

```
@v-color (
  bg-default ( 
    light: var(--color-white),
    dark: var(--color-black)
  ),
  fg-default ( 
    light: var(--color-grey-dark),
    dark: var(--color-grey-light)
  ),
  text-highlight ( 
    light: var(--color-grey-dark),
    dark: var(--color-grey-light)
  )
);
```

```css
:root {
  --color-bg-default: var(--color-white);
  --color-fg-default: var(--color-grey-dark);
}
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg-default: var(--color-black);
    --color-fg-default: var(--color-grey-light);
  }
}
```

## Usage

**Step 1:** Install plugin:

```sh
npm install --save-dev postcss postcss-v-color
```

**Step 2:** Check you project for existed PostCSS config: `postcss.config.js`
in the project root, `"postcss"` section in `package.json`
or `postcss` in bundle config.

If you do not use PostCSS, add it according to [official docs]
and set this plugin in settings.

**Step 3:** Add the plugin to plugins list:

```diff
module.exports = {
  plugins: [
+   require('postcss-v-color'),
    require('autoprefixer')
  ]
}
```

## Todo

- [ ] Add manual mode toggle support
- [ ] Add ability to add custom themes (like dark_dimmed)
- [ ] Add ability to use args in postcss.config.js


[official docs]: https://github.com/postcss/postcss#usage

---
_Source: https://npm.io/package/postcss-v-color · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
