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-palette-generator

v0.7.0

Published

Color palette generation library for TailwindCSS.

Downloads

4,115

Readme

tailwind

Next.js + tailwind.config.js usage example.

/** @type {import('tailwindcss').Config} */
import getPalette from "tailwindcss-palette-generator";

const palette = getPalette([
  {
    color: "#264653",
    name: "primary"
  },
  {
    color: "#2a9d8f",
    name: "secondary"
  },
  {
    color: "#e9c46a",
    name: "sun"
  },
  {
    color: "#f4a261",
    name: "lightorange"
  },
  {
    color: "#e76f51",
    name: "orange"
  }
]);

module.exports = {
  content: [
    "./app/**/*.{js,ts,jsx,tsx}",
    "./pages/**/*.{js,ts,jsx,tsx}",
    "./components/**/*.{js,ts,jsx,tsx}"
  ],
  theme: {
    extend: {
      colors: palette
    }
  },
  plugins: []
};

🎉 Installation

pnpm

pnpm add -D tailwindcss-palette-generator@latest

yarn

yarn add --dev tailwindcss-palette-generator@latest

npm

npm i --save-dev tailwindcss-palette-generator@latest

npm version NPM GitHub Repo stars node-current GitHub last commit npm GitHub top language

👀 Usage

Import

import getPalette from "tailwindcss-palette-generator";

getPalette()

const palette = getPalette(params);

Params :

  • "color" : Main color of your palette. [*Required] (String)
  • "name" : The name of your palette. [*Required] (String)
  • "shade" : What time do you want the main shades of your palette to start and end at. [Optional] (Number)
  • "shades" : Shade layers of your palette. [Optional] (Array)
    • If you add this you should add main shade as well. "shade:"
    • Must be of type array.
    • May consist of at least 3 elements.
If you want to create multiple palettes. You must enter the properties of the palette in array type.

Example:

const palette = getPalette([
  {
    color: "rgb(255, 189, 0)", // required
    name: "primary", // required
    shade: 400
  },
  {
    color: "rgba(255, 189, 0, 1)", // required
    name: "secondary", // required
    shade: 500
  },
  {
    color: "hsl(44, 100%, 50%)", // required
    name: "tertiary", // required
    shade: 600
  },
  {
    color: "#FFBD00", // required
    name: "quaternary", // required
    shade: 300, // you will set shades is mandatory
    shades: [100, 200, 300, 400, 500]
  }
]);
If you will create a palette you can give parameters as json data.

Example:

const objectPalette = getPalette({
  color: "#FFBD00", // required
  name: "primary", // required
  shade: 300, // you will set shaders is mandatory
  shades: [100, 200, 300, 400, 500]
});

Output:

Output

If you don't want to deal with parameters and you only have one color, you can create a palette by sending the string color as a parameter.

Example:

const stringPalette = getPalette("#FFBD00");

Output:

Output

🚀 Dependencies