1.1.4 • Published 5 years ago
@gradient-js/core v1.1.4
@gradient-js/core
gradient-js module for raw (object) gradient output generation
Installation
CLI
Yarn
yarn add @gradient-js/coreNpm
npm install --save @gradient-js/coreCDN
<script src="https://unpkg.com/gradient-js/core@x.x.x/core.js">Usage
import { Core } from '@gradient-js/core';
const core = new Core();
const gradient = core.get(colors, options);Inputs
In order to create a gradient you will need to pass an array of colors and an options object to the Core's get method. colors should be an array of strings in any valid css format (rgb(a), hex or hsl(a)). options object consists of following properties:
type CoreOptions = {
  useBezier: boolean;
  interpolation: InterpolationMode;
  samples: number;
  lightnessCorrection: boolean;
};Where each property can be described as it follows:
| Option | Type | Description | 
|---|---|---|
useBezier | boolean | Decide whether to use chroma's scale() with bezier interpolation | 
interpolation | chroma.InterpolationMode | Color interpolation space, one of: "rgb" | "hsl" | "hsv" | "hsi" | "lab" | "lch" | "hcl" | "lrgb" | 
samples | number | Amount of gradient parts in the output | 
lightnessCorrection | boolean | Decide whether to apply lightness correction to your gradient. | 
Core's get method will generate an array of chroma.Color objects.