项目作者: unjs

项目描述 :
Easily generate color shades for themes
高级语言: TypeScript
项目地址: git://github.com/unjs/theme-colors.git
创建时间: 2020-09-26T12:45:57Z
项目社区:https://github.com/unjs/theme-colors

开源协议:

下载


theme-colors

npm version
npm downloads
bundle
Codecov

Easily generate color shades for themes

Usage

Install package:

  1. # npm
  2. npm install theme-colors
  3. # yarn
  4. yarn add theme-colors
  5. # pnpm
  6. pnpm install theme-colors
  7. # bun
  8. bun install theme-colors

Import:

  1. // ESM
  2. import { getColors } from "theme-colors";
  3. // CommonJS
  4. const { getColors } = require("theme-colors");
  5. const theme = getColors("#ABABAB");
  6. // Or using RGB
  7. const theme = getColors("172,172,172");

This will generate the following shades:

  1. {
  2. 50: '#FBFBFB',
  3. 100: '#F7F7F7',
  4. 200: '#EAEAEA',
  5. 300: '#DDDDDD',
  6. 400: '#C4C4C4',
  7. 500: '#ABABAB',
  8. 600: '#9A9A9A',
  9. 700: '#676767',
  10. 800: '#4D4D4D',
  11. 900: '#333333',
  12. 950: '#222222',
  13. }

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.