1.3.2 • Published 2 years ago

lch-color-utils v1.3.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

LCH Color Utilities

Inspired by https://css.land/lch (Lea Verou)

Getting started

Install via npm or yarn

npm i -S lch-color-utils
yarn add lch-color-utils

Methods

lchToRgb

Usage

lchToRgb({ l: 90, c: 20, h: 100, isPrecise: false, forceinGamut: true });

Parameters

{
    l: number,
    c: number,
    h: number,
    a?: number,
    forceinGamut?: boolean,
    isPrecise?: boolean,
}
FieldDescriptionDefault
lLightness value for LCHundefined
cChroma value for LCHundefined
hHue value for LCHundefined
aAlpha valueundefined
isPreciseIf true, will not round of the RGB percentage valuefalse
forceinGamutMoves an lch color into the sRGB gamut by holding the l and h steady, and adjusting the c via binary-search until the color is on the sRGB boundarytrue

Response

{
    value: number[],
    string: string,
}
FieldDescription
valueArray of numbers representing R, G, B colors of the LCH provided
stringString value of R, G, B. Ex: rgb(20%, 20%, 20%)

hexToLch

Usage

hexToLch('#FF0000');

Parameters

FieldDescriptionDefault
hexHex string to be converted to LCHundefined

Response

{
    l: number,
    c: number,
    h: number,
    a?: number,
}
FieldDescription
lLightness value for LCH
cChroma value for LCH
hHue value for LCH
aAlpha value

lchToHex

Usage

lchToHex({ l: 90, c: 20, h: 100, isPrecise: false, forceinGamut: true });

Parameters

{
    l: number,
    c: number,
    h: number,
    a?: number,
    forceinGamut?: boolean,
    isPrecise?: boolean,
}
FieldDescriptionDefault
lLightness value for LCHundefined
cChroma value for LCHundefined
hHue value for LCHundefined
aAlpha valueundefined
isPreciseIf true, will not round of the RGB percentage valuefalse
forceinGamutMoves an lch color into the sRGB gamut by holding the l and h steady, and adjusting the c via binary-search until the color is on the sRGB boundarytrue

Response

{
    value: string,
    alpha?: number,
}
FieldDescription
valueHex string value of LCH
alphaAlpha value which should be same as the one provided in your request parameters
1.3.2

2 years ago

1.3.1

2 years ago

1.2.9

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago