Skip to main content

Color

cssSupportedFunction​

schemas.color.cssSupportedFunction().getValue() // 'rgb'

cssSupportedSpace​

schemas.color.cssSupportedSpace().getValue() // 'display-p3'

rgb​

schemas.color.rgb().getValue({ prefix: '#' }) // '#ffffFF'
schemas.color.rgb().getValue({ casing: 'upper' }) // '0xFFFFFF'
schemas.color.rgb().getValue({ casing: 'lower' }) // '0xffffff'
schemas.color.rgb().getValue({ prefix: '#', casing: 'lower' }) // '#ffffff'
schemas.color.rgb().getValue({ format: 'hex', casing: 'lower' }) // '#ffffff'
schemas.color.rgb().getValue({ format: 'css' }) // 'rgb(255, 0, 0)'
schemas.color.rgb().getValue({ format: 'binary' }) // '10000000 00000000 11111111'
ArgumentDescription
prefixPrefix of the generated hex color. Only applied when 'hex' format is used. Defaults to '0x'
casingLetter type case of the generated hex color. Only applied when 'hex' format is used. Defaults to 'mixed'
formatFormat of generated RGB color. Defaults to 'hex'
includeAlphaAdds an alpha value to the color (RGBA). Defaults to false

cmyk​

schemas.color.cmyk().getValue() // cmyk(100%, 0%, 0%, 0%)
schemas.color.cmyk().getValue({ format: 'css' }) // cmyk(100%, 0%, 0%, 0%)
schemas.color.cmyk().getValue({ format: 'binary' }) // (8-32 bits) x 4
ArgumentDescription
formatFormat of generated CMYK color. ('css', 'binary')

hsl​

schemas.color.hsl().getValue({ format: 'css' }) // hsl(0deg, 100%, 80%)
schemas.color.hsl().getValue({ format: 'css', includeAlpha: true }) // hsl(0deg 100% 50% / 0.5)
schemas.color.hsl().getValue({ format: 'binary' }) // (8-32 bits) x 3
schemas.color.hsl().getValue({ format: 'binary', includeAlpha: true }) // (8-32 bits) x 4
ArgumentDescription
formatFormat of generated HSL color. ('css', 'binary')
includeAlphaAdds an alpha value to the color (RGBA). Defaults to false

hwb​

schemas.color.hwb().getValue({ format: 'css' }) // hwb(194 0% 0%)
schemas.color.hwb().getValue({ format: 'binary' }) // (8-32 bits x 3)
ArgumentDescription
formatFormat of generated HWB color. ('css', 'binary')

lch​

schemas.color.lch().getValue({ format: 'css' }) // lch(52.2345% 72.2 56.2)
schemas.color.lch().getValue({ format: 'binary' }) // (8-32 bits x 3)
ArgumentDescription
formatFormat of generated LCH color. ('css', 'binary')

colorByCSSColorSpace​

schemas.color
.colorByCSSColorSpace()
.getValue({ format: 'css', space: 'display-p3' }) // color(display-p3 0.12 1 0.23)
schemas.color.colorByCSSColorSpace().getValue({ format: 'binary' }) // (8-32 bits x 3)
ArgumentDescription
formatFormat of generated color. ('css', 'binary')
spaceColor space to generate the color for. Defaults to 'sRGB'.