Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uiw/color-convert

Package Overview
Dependencies
Maintainers
1
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uiw/color-convert

Color Convert

  • 0.0.18
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
45K
decreased by-13.7%
Maintainers
1
Weekly downloads
 
Created
Source

Color Convert

npm bundle size npm version Open in unpkg

Install

npm i @uiw/color-convert

Usage

import { hsvaToHsla } from '@uiw/color-convert'

API

rgbaToHsva
rgbaToHsva({ r: 255, g: 255, b: 255, a: 1 }) //=> { h: 0, s: 0, v: 100, a: 1 }
hexToHsva
hexToHsva("#ffffff") //=> { h: 0, s: 0, v: 100, a: 1 }
hsvaToHex
hsvaToHex({ h: 0, s: 0, v: 100, a: 1 }) // => "#ffffff"
hsvaToHsla
hsvaToHsla({ h: 0, s: 0, v: 100, a: 1 }) // => { h: 0, s: 0, l: 100, a: 1 }
hslaToHsva
hsvaToHsla({ h: 0, s: 0, l: 100, a: 1 }) // => { h: 0, s: 0, v: 100, a: 1 }
hsvaToHslString
hsvaToHsla({ h: 200, s: 40, v: 40, a: 1 }) // => hsl(200, 25%, 32%)
hslStringToHsva
hslStringToHsva('hsl(0, 0%, 100%)') // => { h: 0, s: 0, v: 100, a: 1 }
hslaStringToHsva
hslStringToHsva('hsla(0deg, 0%, 0%, 0.5)') // => { h: 0, s: 0, v: 0, a: 0.5 }
hsvaToRgba
hslStringToHsva({ h: 0, s: 0, v: 100, a: 1 }) // => { r: 255, g: 255, b: 255, a: 1 }
rgbaToHsva
rgbaToHsva({ r: 255, g: 255, b: 255, a: 1 }) // => { h: 0, s: 0, v: 100, a: 1 }
rgbStringToHsva
rgbStringToHsva('rgb(255, 255, 255)') // => { h: 0, s: 0, v: 100, a: 1 }
hsvaToRgbString
hsvaToRgbString({ h: 0, s: 0, v: 100, a: 1 }) // => rgb(255, 255, 255)
hsvaToRgbaString
hsvaToRgbaString({ h: 200, s: 40, v: 40, a: 0.5 }) // => rgba(61, 88, 102, 0.5)
rgbaStringToHsva
rgbaStringToHsva('rgba(61, 88, 102, 0.5)') // => { h: 200, s: 40, v: 40, a: 0.5 }
hsvaToHsvaString
hsvaToHsvaString({ h: 0, s: 0, v: 100, a: 1 }) // => hsva(0, 0%, 100%, 1)
hsvaToHsvString
hsvaToHsvString({ h: 0, s: 0, v: 100, a: 1 }) // => hsv(0, 0%, 100%)
hsvStringToHsva
hsvaToHsvString('hsva(0, 11%, 0, 0.5)') // => { h: 0, s: 11, v: 0, a: 0.5 }
rgbaToRgb
rgbaToRgb({ r: 0, g: 0, b: 0, a: 1 }) //=> { r: 0, g: 0, b: 0 }
rgbaToRgb
hslaToHsl({ h: 0, s: 0, l: 0, a: 1 }) //=> { h: 0, s: 0, l: 0 }
hsvaToHsv
hsvaToHsv({ h: 0, s: 0, v: 0, a: 1 }) //=> { h: 0, s: 0, v: 0 }
equalHex
equalHex("#8c0dba", "#8c0dba") // => true
equalColorObjects
equalColorObjects({ h: 0, s: 0, v: 5, a: 0.5 }, { h: 0, s: 0, v: 5, a: 0.5 }) // => true
equalColorString
equalColorString("rgb(0,0,0)", "rgb(0, 0, 0)") //=> true
hsvaToHslaString
hsvaToHslaString({ h: 200, s: 40, v: 40, a: 0.5 }) //=> hsla(200, 25%, 32%, 0.5)
validHex
validHex("#8c0dba") //=> true
rgbaToHexa
rgbaToHexa({ b: 26, g: 2, r: 209, a: 1 }) // => '#d1021aff'
color
const { rgb, rgba, hsl, hsv, hsla, hsva } = color('#d1021a');
// rgb   => { b: 26, g: 2, r: 209, }
// rgba  => { b: 26, g: 2, r: 209, a: 1 }
// hsl   => { h: 353.04347826086956, l: 41.37254901960784, s: 98.10426540284361 }
// hsla  => { h: 353.04347826086956, l: 41.37254901960784, s: 98.10426540284361, a: 1 }
// hsv   => { h: 353.04347826086956, s: 99.04306220095694, v: 81.96078431372548 }
// hsva  => { h: 353.04347826086956, s: 99.04306220095694, v: 81.96078431372548, a: 1 }
// hex   => '#d1021a'
// hexa  => '#d1021aff'

License

Licensed under the MIT License.

Keywords

FAQs

Package last updated on 12 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc