@pencil.js/color

1.18.0 • Public • Published

Color

Useful class to manipulate colors.

Installation

npm install @pencil.js/color

Examples

import Color from "@pencil.js/color";

const alpha = 0.9; // Opacity
// All are equivalent
const rebeccapurple = new Color("rebeccapurple", alpha);
const rebeccapurple = new Color(
    0.4, // Red ratio
    0.2, // Green ratio
    0.6, // Blue ratio
    alpha,
);
const rebeccapurple = new Color("#663399", alpha);
const rebeccapurple = new Color("#639", alpha);
const rebeccapurple = new Color(0x663399, alpha); // Careful, 0x639 is equivalent to 0x000639 and not to 0x663399

shape.options.fill = rebeccapurple.saturation(0.5).lerp(otherColor, 0.5).reverse();

Readme

Keywords

Package Sidebar

Install

npm i @pencil.js/color

Weekly Downloads

1

Version

1.18.0

License

MIT

Unpacked Size

11.2 kB

Total Files

4

Last publish

Collaborators

  • gmartigny