What is Colors JS?
Colors JS is a powerful tool that includes a set of JavaScript functions that can help you with a variety of color-related tasks, such as:
- Converting colors between different formats
- Creating color palettes
- Rating the contrast of two colors based on WCAG (Web Content Accessibility Guidelines)
- Generating random colors
- Simulating different types of color blindness
- Extracting color palettes from an image
Add Color JS to your project
npm install colors-kit
The colors-kit package is built in pure TypeScript and can be used on projects that use vanilla JavaScript or any JavaScript framework.
Basic Usage
In this section, we will see a simple usage of the colors-kit package to convert a color to another format.
import { hexToRgb } from "colors-kit";
const hexadecimalColor = "#ff4722";
const rgbColor = hexToRgb(hexadecimalColor); // { r: 255, g: 71, b: 34 }