npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tailwindcss-radix-colors-plugin

v0.3.0

Published

![GitHub](https://img.shields.io/github/license/yp717/tailwindcss-radix-colors-plugin) ![npm](https://img.shields.io/npm/v/tailwindcss-radix-colors-plugin)

Downloads

33

Readme

tailwindcss-radix-colors-plugin

GitHub npm

Introduction

tailwindcss-radix-colors-plugin is a plugin for Tailwind CSS that adds the Radix UI Color Palette to your Tailwind CSS configuration. This plugin allows you to use Radix colors directly in your Tailwind utility classes, making color management effortless and consistent across your projects.

Key Features

Some of the key features tailwindcss-radix-colors-plugin offers include:

  • Seamless Integration: The plugin works effortlessly with Tailwind CSS, allowing you to take advantage of the Radix color palette without any disruption to your workflow.
  • Dynamic Color Management: Manage your colors efficiently with this plugin. It maintains the consistency of your design while also providing a rich color palette for your projects.
  • Accessibility: Colors are WCAG-compliant, ensuring your designs are accessible to a wide range of users, including those with visual impairments.
  • Customization: The plugin is highly customizable, allowing you to tailor the palette to your specific needs
  • Dark Mode OOTB: The plugin supports dark mode out of the box, allowing you to easily switch between light and dark mode. But, when you want to deviate from Radix's automatic inversions, you can still access the variables you need not to limit your creativity or your design freedom!

Get Started

Prerequisites

To use the Tailwind CSS Radix Colors plugin, ensure:

  • You're using Node.js version 12 or newer.
  • Your project uses Tailwind CSS 2.0 or newer.
  • Your project processes CSS with PostCSS (true for tools like Create React App, Next.js, or Gatsby).

Installation

Install the plugin with npm:

npm install tailwindcss-radix-colors-plugin

Basic Usage

To use the plugin, import it in your Tailwind CSS configuration file (tailwind.config.js) and add it to your configuration:

const { tailwindRadixPlugin } = require('tailwindcss-radix-colors-plugin')

/** @type {import('tailwindcss').Config} \*/
module.exports = {
    content: ['./src/**/\*.{js,ts,jsx,tsx,mdx}'],
    darkMode: 'class',
    theme: {
        // your theme configuration
    },
    variants: {
        // your variants configuration
    },
    plugins: [
        tailwindRadixPlugin(),
        // your other plugins
    ],
}

Your Tailwind CSS utility classes now have access to the Radix color palette. You can use these classes just like any other utility classes provided by Tailwind CSS:

<div className="text-crimson-500 bg-indigo-1000">
  <!-- your content -->
</div>

Advanced Usage

Tailwind Dark Mode: Class vs Media

Tailwind CSS provides two strategies for dark mode: 'class' and 'media'. The 'media' strategy uses the CSS prefers-color-scheme media feature to automatically switch based on the user's system preferences:

module.exports = {
    darkMode: 'media',
    // ...
}

The 'class' strategy allows manual dark mode toggling. Dark variants are applied whenever the 'dark' class is present on the html element:

module.exports = {
    darkMode: 'class',
    // ...
}

NOTE: Please note that you should not use the 'media' strategy if you want to support manual toggling.

For more details, refer to the official Tailwind CSS documentation.

Including Specific Colors

If you prefer to include specific colors from the Radix palette, pass an options object to the plugin function:

plugins: [
    tailwindRadixPlugin({
        colors: ['red', 'blue', 'green'],
    }),
    // ...
],

You can specify either the specific light or dark variants of a color, or you can specify the general color you want to include. For example, you can set colors to ['redLight'] or ['redDark'], or you can set colors to ['red'] to include both the light and dark variants of the color.

Please note if you are using NextJS you may need to restart your dev server after adding or removing colors.