Skip to content

Commit

Permalink
chore: update README.
Browse files Browse the repository at this point in the history
  • Loading branch information
lilingxi01 committed Dec 19, 2023
1 parent 5ba073b commit 358ca13
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ Radix Colors is a great color palette for software design and development. I lov

This library is intended to provide a simple way to integrate all benefits of Radix Colors in Tailwind CSS, including alpha values, P3 display, and composing ability. It generally parses the original library and generates a plug-able Tailwind CSS plugin.

## Why Radix Colors when Tailwind CSS already has a color palette?

The default color palette of Tailwind CSS is great, but it is not efficient to build, and it usually makes your code long and unmaintainable.

* With Tailwind CSS Color Palette: `text-gray-900 bg-gray-100 dark:text-gray-100 dark:bg-gray-900`
* With Radix Colors: `text-mauve-12 bg-mauve-1`

Above classes are nearly equivalent in both light and dark mode. But the first one is much longer and harder to maintain.

It is also not quite clear what color to map with in dark mode because the original color palette of Tailwind CSS is designed to be used interchangeably in both light and dark mode. For example, `gray-100` is a light color and `gray-900` is a dark color. It is not clear what color to use in dark mode for `gray-50` because there is no `gray-950`.

But with Radix Colors, the dark mode colors are uniquely-selected and well-crafted. You don't have to worry about what color to use in dark mode, and you don't have to define them again. You can still specify a dark-mode color explicitly when you need to, but it becomes super rare to do so.

## Why Radix Colors for Tailwind CSS instead of the original library?

The CSS files in the [original Radix Colors library](https://github.com/radix-ui/colors) is all built with Hex color format. It is usable, but it loses the great ability of Tailwind CSS to inject alpha values. For example, you can't use `bg-mauve-4/50` to get a semi-transparent color from `bg-mauve-4`. This library is intended to solve this problem and further with P3 display support (including P3 display with alpha value injection).

## Usage

TBA.
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"name": "radix-colors-tailwind",
"version": "0.0.1",
"main": "generator/index.ts",
"main": "dist/index.ts",
"type": "module",
"files": [
"dist"
],
"scripts": {
"prod": "bun generator/index.ts",
"lint": "eslint generator/*"
Expand Down

0 comments on commit 358ca13

Please sign in to comment.