Color utilities
npm install @daeinc/colorColor utilities. Mostly wrapper functions on existing packages for convenience.
``sh`
npm i @daeinc/color
then,
`ts`
import { hsv2rgb, ... } from "@daeinc/color"Functions
`ts`
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[];[0, 1]
Converts HSV/HSB color to RGB. Each channel of the input HSV color must be normalized to range.
A typical usage is as follows:
`tsrgb(${hsv2rgb(0, 1, 1)})
ctx.strokeStyle = // red`
`ts`
const hsb2rgb: typeof hsv2rgb;hsv2rgb
Alias for .
`ts`
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[];[0, 1]
Converts RGB color to HSV. The out color is normalized to range.
`ts`
function hex2rgb(hex: string): number[];
Converts HEX color string to RGB color.
- add
- rgb2hsl and hsl2rgbhex2hsv
- color-functions
- try
- color-normalize`
-
MIT