An open API service indexing awesome lists of open source software.

https://github.com/programming-with-ia/tailwindcss-shadcn-utilities

A Tailwind CSS plugin for ShadCN that provides utility classes for combining background and foreground colors based on ShadCN themes
https://github.com/programming-with-ia/tailwindcss-shadcn-utilities

color-utilities plugin shadcn shadcn-tailwind-plugin shadcn-utilites tailwindcss tailwindcss-plugin tailwindcss-shadcn-utilities utilites

Last synced: about 2 months ago
JSON representation

A Tailwind CSS plugin for ShadCN that provides utility classes for combining background and foreground colors based on ShadCN themes

Awesome Lists containing this project

README

          

Tailwindcss Shadcn Utilities


A plugin for Tailwind CSS v3.2+ that provides utility classes for combining background and foreground colors based on ShadCN themes. This allows you to apply consistent color combinations for elements like buttons, cards, popovers, and more with a single CSS class.

## Installation

Install the plugin from npm:

```sh
npm install tailwindcss-shadcn-utilities -D
```

```sh
pnpm add tailwindcss-shadcn-utilities -D
```

```sh
yarn add tailwindcss-shadcn-utilities --dev
```

Then add the plugin to your `tailwind.config.js` file:

```js
// tailwind.config.js
module.exports = {
theme: {
// ...
},
plugins: [
require("tailwindcss-shadcn-utilities"),
// ...
],
};
```

## Usage

After adding the plugin, you can use the following utility classes to apply both background and foreground colors in one go:

| ~~Normal Use~~ | with `tailwindcss-shadcn-utilities` |
| -------------------------------------------- | ----------------------------------- |
| `bg-card text-card-foreground` | `card` |
| `bg-popover text-popover-foreground` | `popover` |
| `bg-primary text-primary-foreground` | `primary` |
| `bg-secondary text-secondary-foreground` | `secondary` |
| `bg-muted text-muted-foreground` | `muted` |
| `bg-accent text-accent-foreground` | `accent` |
| `bg-destructive text-destructive-foreground` | `destructive` |

### Example

```html



Button

Button




```

These utility classes will automatically apply both background and text colors based on the ShadCN UI theme.

## License

`tailwindcss-shadcn-utilities` is open-source and licensed under the [MIT License](./LICENSE).