🎨 PigmentTS

Getting Started

Get started with the library

Installation

Install the package using your package manager of choice.

shell npm install pigment-ts

Usage

Import all the function you need

index.ts
import { convertColor, lightenColor, toTailwind } from "pigment-ts";
 
// Convert HEX to RGB
const rgb = convertColor("#ff5733", "rgb");
console.log(rgb); // 'rgb(255, 87, 51)'
 
// Lighten a color by 20%
const lighter = lightenColor("#ff5733", 20);
console.log(lighter); // '#FF8A66'
 
// Get Tailwind CSS class
const twClass = toTailwind("#ef4343");
console.log(twClass); // 'red-500'

Use all functions via default import

index.ts
import PigmentTS from "pigment-ts";
 
const randomHex = PigmentTS.randomColor("hex");
console.log(randomHex); // '#A1B2C3'

Note

You can also use in javascript files.

On this page