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

tailwix

v3.0.0

Published

Power of Tailwind CSS + Radix Colors

Downloads

321

Readme

Tailwix

Tailwix = Power of Tailwind CSS + Radix Colors.

Motivation

Ever struggled with choosing and managing colors for your website when switching between dark and light mode, finding yourself spreading the dark variant across all of your files? I have, which is why I created this package to make this simpler. It combines all the features of Tailwind CSS with a big and REALLY AWESOME collection of colors from Radix.

Features

✅ 31 different color scales.
✅ Black and white including their alpha scales.
✅ 12 steps (from 1 to 12) per color scale.
✅ 12 alpha steps (from a1 to a12) per alpha color scale.
✅ Simplified color naming conventions aligned with Radix Colors standards.
✅ Handling of light and dark mode themes based on HTML element class names.

Get Started

To get going with Tailwix, make sure you have the pre-release version (v4 alpha-19 or higher) of Tailwind CSS installed.

Install Tailwind CSS v4 Alpha 19 or higher

Just follow the steps in one of the official Tailwind CSS blogs to install the v4 alpha release.

Install Tailwix

You can easily install Tailwix with your favorite package manager.

# with pnpm
pnpm add tailwix

# with bun
bun add tailwix

# with npm
npm install tailwix

# with yarn
yarn add tailwix

Importing

Import the Tailwind CSS styles, and then import Tailwix right after:

@import 'tailwindcss';
@import 'tailwix';

If you want to import only some specific colors to decrease the final CSS output:

@import 'tailwindcss';

@import 'tailwix/colors/white.css';
@import 'tailwix/colors/white-alpha.css';

@import 'tailwix/colors/black.css';
@import 'tailwix/colors/black-alpha.css';

@import 'tailwix/colors/red.css';
@import 'tailwix/colors/red-alpha.css';

@import 'tailwix/colors/blue.css';
@import 'tailwix/colors/blue-alpha.css';

This will not clear the color namespace from Tailwind CSS but give you access to a whole bunch of new colors to use in your project!

  • There are 33 different color scales (red, green, blue, etc.), including black and white.
  • Each color scale has light and dark versions (at least to handle contrast issues).
  • Each color scale consists of 12 steps ranging from 1 to 12 (equivalent to Tailwind CSS's range from 50 to 950).
  • Each color scale consists of 12 alpha steps ranging from a1 to a12.

To clear remove Tailwind colors you can just create a new CSS file clear.css with the following content:

@theme {
    --color-*: initial;
}

Then import it before importing Tailwix:

@import 'tailwindcss';
@import './path/to/clear.css';

/* then import anything you want from Tailwix */
@import 'tailwix';

For more information about naming conventions and other related details, refer to Radix Colors.

Usage

Let's create a button using the ruby color scale:

<main className='text-gray-12 bg-gray-2'>
  <button className='text-ruby-11 bg-ruby-a3 hover:bg-ruby-a4 active:bg-ruby-a5'>
    Get Started
  </button>
</main>

Note that we did NOT need to invert colors in dark mode using the :dark variant.

If the class name of the root element (or any wrapper element) is empty or includes .light and/or .light-theme, the light scales will be applied. Conversely, if it includes .dark and/or .dark-theme,the dark scales will be applied instead.

Result

Tailwix - Demo

Contributing

If you're interested in contributing to Tailwix, please read the contributing docs.