value between 0 - 1 or 1 - 100 representing a relative percent in which to blacken the color
Retrieves a color channel from the color model via key.
the name of the channel from the current color space to retrieve
the value of the channel matching the provided key
Darkens the RGB color space by a relative ratio.
percentage to darken the color by as a value between [0,1], or (1,100]
Desaturates the color space by a relative ratio. The color is desaturated by converting the value to HSL (if not already HSL), adjusting the saturation, and converting back to the original color space if needed.
the relative ratio to desaturate the color
Converts the color space channels to grayscale using a Weighted Method (aka Luminosity Method). It does so by first converting the color space to RGBA (if not already RGBA), applies greyscale, then converts back to the original color space if needed;
Lightens the color space by a relative ratio.
a value between [0,1] or (1,100] as the ratio to adjust the lightness of the color space
Mixes this color with the provided color model value by the specified weight.
the color model to mix into the color space
the weight in which the color should be mixed
Rotates the hue of the color space by a given number of degrees.
the number of degrees to rotate the hue channel
Saturates the color space by a relative ratio. The color is saturated by converting the value to HSL (if not already HSL), adjusting the saturation, and converting back to the original color space if needed.
the relative ratio to saturate the color
Returns a hex string representing the RGB color space. This ignores any
alpha values.
Example
color.toString() // rgb(185,130,91)
color.toHexString() // #b9825b
color.toHexString(true) // b9825b
will return the hex value without a hashtag if true, otherwise will return with hashtag
Returns this color space model. This record contains named channels and their corresponding values.
the color model record
Whiten the color space value by a relative ratio. This function converts the color space to HWB (if not already HWB), adds whiteness value, and converts back to the original color space if needed.
value between 0 - 1 or 1 - 100 representing a relative percent in which to whiten the color
Retrieves the value of the hue channel for the current color space.
the hue channel value of this color space
Retrieves the value of the saturation channel for the current color space.
the saturation channel value of this color space
Retrieves the value of the lightness channel for the current color space.
the lightness channel value of this color space
Retrieves an array representing the HSL color space containing the primary colors.
the HSL color space values as an array
Prints valid CSS string value.
valid CSS color value.
Generated using TypeDoc
Blackens the color space value by a relative ratio. This function converts the color space to HWB if needed, adds blackness value, and converts back to the original color space if not originally HWB.