0.0.2 • Published 10 months ago

gradient-to-object v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Gradient To Object

This packages takes css gradient string as an input and converts it to a JSON Object..

interface GradientObject {
  type: string;
  stops: { color: string; position: number }[];
  angle: number;
}

Installation

pnpm i gradient-to-object

Usage

// mjs
import { gradientToObject } from "gradient-to-object";
// cjs
const { gradientToObject } = require("gradient-to-object");

const gradientString = "linear-gradient(120deg, #a1c4fd 10%, #c2e9fb 80%)";

const gradientObject = gradientToObject(gradientString);

console.log(gradientObject);
0.0.2

10 months ago

0.0.1

10 months ago