Code Monkey home page Code Monkey logo

tailwindcss-palette-generator's Introduction

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

tailwindcss-palette-generator's People

Contributors

dependabot[bot] avatar ibodev1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.