0.2.4 • Published 1 year ago

@daeinc/color v0.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@daeinc/color

Color utilities. Mostly wrapper functions on existing packages for convenience.

npm i @daeinc/color

then,

import { hsv2rgb, ... } from "@daeinc/color"

Functions

hsv2rgb

function hsv2rgb(val: number): number[];
function hsv2rgb(arr: number[]): number[];
function hsv2rgb(h: number, s: number, v: number): number[];
function hsv2rgb(
  h: number,
  s: number,
  v: number,
  a: number
): number[];

Converts HSV/HSB color to RGB. Each channel of the input HSV color must be normalized to [0, 1] range.

A typical usage is as follows:

ctx.strokeStyle = `rgb(${hsv2rgb(0, 1, 1)})` // red

hsb2rgb

const hsb2rgb: typeof hsv2rgb;

Alias for hsv2rgb.

rgb2hsv

function rgb2hsv(arr: number[]): number[];
function rgb2hsv(r: number, g: number, b: number): number[];
function rgb2hsv(
  r: number,
  g: number,
  b: number,
  a: number
): number[];

Converts RGB color to HSV. The out color is normalized to [0, 1] range.

hex2rgb

function hex2rgb(hex: string): number[];

Converts HEX color string to RGB color.

To dos

License

MIT

0.2.3

1 year ago

0.2.2

2 years ago

0.2.4

1 year ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago