0.4.14 • Published 3 months ago

@sil/color v0.4.14

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

Color

Converting colors back and forth.

Convert Functions

Direct conversion

hexToRgb

inputType: HEX outputType: RGB | RGBA

hexToCmyk

inputType: HEX outputType: CMYK

hexToHsl

inputType: HEX outputType: HSL | HSLA

hexToHsv

inputType: HEX outputType: HSV | HSVA

rgbToHsl

inputType: RGB | RGBA outputType: HSL | HSLA

rgbToHex

inputType: RGB | RGBA outputType: HEX

rgbToCmyk

inputType: RGB | RGBA outputType: CMYK

rgbToHsv

inputType: RGB outputType: HSV | HSVA

cmykToRgb

inputType: CMYK outputType: RGB | RGBA

cmykToHex

inputType: CMYK outputType: HEX

cmykToHsl

inputType: CMYK outputType: HSL | HSLA

cmykToHsv

inputType: CMYK outputType: HSV | HSVA

hslToHex

inputType: HSL | HSLA outputType: HEX

hslToRgb

inputType: HSL | HSLA outputType: RGB | RGBA

hslToCmyk

inputType: HSL | HSLA outputType: CMYK

hslToHsv

inputType: HSL | HSLA outputType: HSV | HSVA

hsvToHex

inputType: HSV | HSVA outputType: HEX

hsvToRgb

inputType: HSV | HSVA outputType: RGB | RGBA

hsvToCmyk

inputType: HSV | HSVA outputType: CMYK

hsvToHsl

inputType: HSV | HSVA outputType: HSL | HSLA

Convert Function - To

Determine the type and based on that convert to the type requested

toHex

inputType: COLOR outputType: HEX

toCMYK

inputType: COLOR outputType: HSV | HSVA

toRGB

inputType: COLOR outputType: RGB | RGBA

toHSL

inputType: COLOR outputType: HSL | HSLA

toHSV

inputType: COLOR outputType: HSV | HSVA

Manipulate

getType

inputType: COLOR outputType: ColorType

setLightness

inputType: COLOR outputType: Inherit from input

lighten

inputType: COLOR outputType: Inherit from input

darken

inputType: COLOR outputType: Inherit from input

mix

inputType: COLOR outputType: Inherit from input

Types

typeexample
HEXstring#000000
RGBr: Base16Number,{ r: 0, g: 0, b: 0}
g: Base16Number,
b: Base16Number
RGBAr: Base16Number,{ r: 0, g: 0, b: 0, a: 0}
g: Base16Number,
b: Base16Number,
a: BinaryNumber,
HSLh: GradientNumber,{ h: 0, s: 0, l: 0}
s: PercentageNumber,
l: PercentageNumber,
HSLAh: GradientNumber,{ h: 0, s: 0, l: 0}
s: PercentageNumber,
l: PercentageNumber,
a: BinaryNumber,
HSVh: GradientNumber,{ h: 0, s: 0, l: 0}
s: PercentageNumber,
v: PercentageNumber,
HSVAh: GradientNumber,{ h: 0, s: 0, l: 0}
s: PercentageNumber,
v: PercentageNumber,
a: BinaryNumber,
CMYKc: PercentageNumber,{ c: 0, m: 0, y: 0, k: 0}
m: PercentageNumber,
y: PercentageNumber,
k: PercentageNumber,
COLORany of the above

Base16Number: Integer between 0 and 255 BinaryNumber: Integer PercentageNumber: Integer between 0 and 100 GradientNumber: Integer between 0 and 360

0.4.14

3 months ago

0.4.10

3 months ago

0.4.13

3 months ago

0.4.11

3 months ago

0.4.12

3 months ago

0.4.9

3 months ago

0.4.8

1 year ago

0.4.4

1 year ago

0.4.7

1 year ago

0.4.6

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.3.1

1 year ago

0.4.3

1 year ago

0.4.2

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.7

1 year ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago