Class Colord
Index
Constructors
Methods
Properties
Methods
alpha
- Returns number
brightness
- Returns the brightness of a color (from 0 to 1). The calculation logic is modified from WCAG. https://www.w3.org/TR/AERT/#color-contrast - Returns number
darken
- Increases the HSL lightness of a color by the given amount. - Parameters- Optionalamount: number
 - Returns Colord
desaturate
- Decreases the HSL saturation of a color by the given amount. - Parameters- Optionalamount: number
 - Returns Colord
grayscale
- Makes a gray color with the same lightness as a source color. - Returns Colord
hue
- Allows to get or change a hue value. - Returns number
invert
- Creates a new instance containing an inverted (opposite) version of the color. - Returns Colord
isDark 
- Same as calling - brightness() < 0.5.- Returns boolean
isEqual 
isLight 
- Same as calling - brightness() >= 0.5.- Returns boolean
isValid 
- Returns a boolean indicating whether or not an input has been parsed successfully. Note: If parsing is unsuccessful, Colord defaults to black (does not throws an error). - Returns boolean
lighten
- Increases the HSL lightness of a color by the given amount. - Parameters- Optionalamount: number
 - Returns Colord
rotate
saturate
- Increases the HSL saturation of a color by the given amount. - Parameters- Optionalamount: number
 - Returns Colord
toHex 
- Returns the hexadecimal representation of a color. When the alpha channel value of the color is less than 1, it outputs #rrggbbaa format instead of #rrggbb. - Returns string
toHsl 
- Converts a color to HSL color space and returns an object. Always includes an alpha value from 0 to 1. - Parameters- Optionaldigits: number
 - Returns HslaColor
toHslString  
- Converts a color to HSL color space and returns a string representation. Always includes an alpha value from 0 to 1. - Parameters- Optionaldigits: number
 - Returns string
toHsv 
- Converts a color to HSV color space and returns an object. Always includes an alpha value from 0 to 1. - Parameters- Optionaldigits: number
 - Returns HsvaColor
toRgb 
- Converts a color to RGB color space and returns an object. Always includes an alpha value from 0 to 1. - Parameters- Optionaldigits: number
 - Returns RgbaColor
toRgbString  
- Converts a color to RGB color space and returns a string representation. Outputs an alpha value only if it is less than 1. - Parameters- Optionaldigits: number
 - Returns string
Allows to get or change an alpha channel value.