Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

theme-colors

unjs13.9kMIT0.1.0TypeScript support: included

Easily generate color shades for themes

theme, colors, shades, tailwind, tailwindcss

readme

theme-colors

npm version npm downloads bundle Codecov

Easily generate color shades for themes

Usage

Install package:

# npm
npm install theme-colors

# yarn
yarn add theme-colors

# pnpm
pnpm install theme-colors

# bun
bun install theme-colors

Import:

// ESM
import { getColors } from "theme-colors";

// CommonJS
const { getColors } = require("theme-colors");

const theme = getColors("#ABABAB");
// Or using RGB
const theme = getColors("172,172,172");

This will generate the following shades:

{
  50: '#FBFBFB',
  100: '#F7F7F7',
  200: '#EAEAEA',
  300: '#DDDDDD',
  400: '#C4C4C4',
  500: '#ABABAB',
  600: '#9A9A9A',
  700: '#676767',
  800: '#4D4D4D',
  900: '#333333',
  950: '#222222',
}

Development

  • Clone this repository
  • Install latest LTS version of Node.js
  • Enable Corepack using corepack enable
  • Install dependencies using pnpm install
  • Run interactive tests using pnpm dev

License

Inspired by javisperez/tailwindcolorshades

Made with 💛

Published under MIT License.

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

v0.1.0

compare changes

🚀 Enhancements

  • Add 950 shade (#19)

🏡 Chore

  • Use correct org for coverage badge (#17)
  • Update renovate config (#15)
  • Update repository (#30)

🤖 CI

  • Add autofix action (#29)

❤️ Contributors

0.0.5 (2020-10-15)

Bug Fixes

  • ensure color is string before parsing (fa6bb1f)

0.0.4 (2020-10-13)

Bug Fixes

  • correct rgb synxtax in parseColor error (6499e26)

0.0.3 (2020-10-13)

Features

  • support hex shorthand syntax (closes #2) (6c99266)

Bug Fixes

  • throw error if color passed to parseColor has invalid format (fixes #1) (49cea61)

0.0.2 (2020-09-26)

0.0.1 (2020-09-26)