Color Convert
Install
npm i @uiw/color-convert
Usage
import { hsvaToHsla } from '@uiw/color-convert'
API
rgbaToHsva
rgbaToHsva({ r: 255, g: 255, b: 255, a: 1 })
hexToHsva
hexToHsva("#ffffff")
hsvaToHex
hsvaToHex({ h: 0, s: 0, v: 100, a: 1 })
hsvaToHsla
hsvaToHsla({ h: 0, s: 0, v: 100, a: 1 })
hslaToHsva
hsvaToHsla({ h: 0, s: 0, l: 100, a: 1 })
hsvaToHslString
hsvaToHsla({ h: 200, s: 40, v: 40, a: 1 })
hslStringToHsva
hslStringToHsva('hsl(0, 0%, 100%)')
hslaStringToHsva
hslStringToHsva('hsla(0deg, 0%, 0%, 0.5)')
hsvaToRgba
hslStringToHsva({ h: 0, s: 0, v: 100, a: 1 })
rgbaToHsva
rgbaToHsva({ r: 255, g: 255, b: 255, a: 1 })
rgbStringToHsva
rgbStringToHsva('rgb(255, 255, 255)')
hsvaToRgbString
hsvaToRgbString({ h: 0, s: 0, v: 100, a: 1 })
hsvaToRgbaString
hsvaToRgbaString({ h: 200, s: 40, v: 40, a: 0.5 })
rgbaStringToHsva
rgbaStringToHsva('rgba(61, 88, 102, 0.5)')
hsvaToHsvaString
hsvaToHsvaString({ h: 0, s: 0, v: 100, a: 1 })
hsvaToHsvString
hsvaToHsvString({ h: 0, s: 0, v: 100, a: 1 })
hsvStringToHsva
hsvaToHsvString('hsva(0, 11%, 0, 0.5)')
rgbaToRgb
rgbaToRgb({ r: 0, g: 0, b: 0, a: 1 })
rgbaToRgb
hslaToHsl({ h: 0, s: 0, l: 0, a: 1 })
hsvaToHsv
hsvaToHsv({ h: 0, s: 0, v: 0, a: 1 })
equalHex
equalHex("#8c0dba", "#8c0dba")
equalColorObjects
equalColorObjects({ h: 0, s: 0, v: 5, a: 0.5 }, { h: 0, s: 0, v: 5, a: 0.5 })
equalColorString
equalColorString("rgb(0,0,0)", "rgb(0, 0, 0)")
hsvaToHslaString
hsvaToHslaString({ h: 200, s: 40, v: 40, a: 0.5 })
validHex
validHex("#8c0dba")
rgbaToHexa
rgbaToHexa({ b: 26, g: 2, r: 209, a: 1 })
color
const { rgb, rgba, hsl, hsv, hsla, hsva } = color('#d1021a');
License
Licensed under the MIT License.