colour-utils
TypeScript icon, indicating that this package has built-in type declarations

1.2.4 • Public • Published

colour-utils

Utility library for colour manipulation.

Installation

npm install colour-utils

Usage

mix

Mixes 2 colours according to the provided ratio.

Arguments

  • colourA (string): The first colour to mix, in hex format (e.g. '#000000').
  • colourB (string): The second colour to mix, in hex format (e.g. '#000000').
  • [ratio = 0.5] (number): The ratio of colourB in the resulting mix. Should be between 0 and 1, inclusive.

Return

(string): The colour resulting from mixing colourA and colourB, in hex format (e.g. '#000000').

Example

import { mix } from 'colour-utils';

mix('#000000', '#444444', .25);
// '#111111'

Readme

Keywords

Package Sidebar

Install

npm i colour-utils

Weekly Downloads

7

Version

1.2.4

License

MIT

Unpacked Size

5.42 kB

Total Files

7

Last publish

Collaborators

  • kawouin