@cobalt-ui/plugin-css
TypeScript icon, indicating that this package has built-in type declarations

1.7.4 • Public • Published

@cobalt-ui/plugin-css

Generate CSS from your design tokens using Cobalt.

Features

  • ✅ 🌈 Automatic P3 color enhancement
  • ✅ Automatic mode inheritance (e.g. light/dark mode)

Basic Setup

Install the plugin from npm:

npm i -D @cobalt-ui/plugin-css

Then add to your tokens.config.mjs file:

// tokens.config.mjs
import pluginCSS from "@cobalt-ui/plugin-css";

/** @type {import("@cobalt-ui/core").Config} */
export default {
  tokens: "./tokens.json",
  outDir: "./tokens/",
  plugins: [pluginCSS()],
};

And run:

npx co build

You’ll then get a ./tokens/tokens.css file with CSS variables for you to use anywhere in your app:

/* tokens/tokens.css */

:root {
  --color-blue: #0969da;
  --color-green: #2da44e;
  --color-red: #cf222e;
  --color-black: #101010;
  --color-ui-text: var(--color-black);
}

Docs

View the full documentation

Package Sidebar

Install

npm i @cobalt-ui/plugin-css

Weekly Downloads

7,185

Version

1.7.4

License

MIT

Unpacked Size

136 kB

Total Files

67

Last publish

Collaborators

  • drewpowers