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

@sil/color

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sil/color

Converting colors back and forth.

  • 0.4.6
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by20%
Maintainers
2
Weekly downloads
 
Created
Source

Color

Converting colors back and forth.

Convert Functions

Direct conversion

hexToRgb

inputType: HEX outputType: RGB | RGBA

hexToCmyk

inputType: HEX outputType: CMYK

hexToHsl

inputType: HEX outputType: HSL | HSLA

hexToHsv

inputType: HEX outputType: HSV | HSVA

rgbToHsl

inputType: RGB | RGBA outputType: HSL | HSLA

rgbToHex

inputType: RGB | RGBA outputType: HEX

rgbToCmyk

inputType: RGB | RGBA outputType: CMYK

rgbToHsv

inputType: RGB outputType: HSV | HSVA

cmykToRgb

inputType: CMYK outputType: RGB | RGBA

cmykToHex

inputType: CMYK outputType: HEX

cmykToHsl

inputType: CMYK outputType: HSL | HSLA

cmykToHsv

inputType: CMYK outputType: HSV | HSVA

hslToHex

inputType: HSL | HSLA outputType: HEX

hslToRgb

inputType: HSL | HSLA outputType: RGB | RGBA

hslToCmyk

inputType: HSL | HSLA outputType: CMYK

hslToHsv

inputType: HSL | HSLA outputType: HSV | HSVA

hsvToHex

inputType: HSV | HSVA outputType: HEX

hsvToRgb

inputType: HSV | HSVA outputType: RGB | RGBA

hsvToCmyk

inputType: HSV | HSVA outputType: CMYK

hsvToHsl

inputType: HSV | HSVA outputType: HSL | HSLA

Convert Function - To

Determine the type and based on that convert to the type requested

toHex

inputType: COLOR outputType: HEX

toCMYK

inputType: COLOR outputType: HSV | HSVA

toRGB

inputType: COLOR outputType: RGB | RGBA

toHSL

inputType: COLOR outputType: HSL | HSLA

toHSV

inputType: COLOR outputType: HSV | HSVA

Manipulate

getType

inputType: COLOR outputType: ColorType

setLightness

inputType: COLOR outputType: Inherit from input

lighten

inputType: COLOR outputType: Inherit from input

darken

inputType: COLOR outputType: Inherit from input

mix

inputType: COLOR outputType: Inherit from input

Types

typeexample
HEXstring#000000
RGBr: Base16Number,{ r: 0, g: 0, b: 0}
g: Base16Number,
b: Base16Number
RGBAr: Base16Number,{ r: 0, g: 0, b: 0, a: 0}
g: Base16Number,
b: Base16Number,
a: BinaryNumber,
HSLh: GradientNumber,{ h: 0, s: 0, l: 0}
s: PercentageNumber,
l: PercentageNumber,
HSLAh: GradientNumber,{ h: 0, s: 0, l: 0}
s: PercentageNumber,
l: PercentageNumber,
a: BinaryNumber,
HSVh: GradientNumber,{ h: 0, s: 0, l: 0}
s: PercentageNumber,
v: PercentageNumber,
HSVAh: GradientNumber,{ h: 0, s: 0, l: 0}
s: PercentageNumber,
v: PercentageNumber,
a: BinaryNumber,
CMYKc: PercentageNumber,{ c: 0, m: 0, y: 0, k: 0}
m: PercentageNumber,
y: PercentageNumber,
k: PercentageNumber,
COLORany of the above

Base16Number: Integer between 0 and 255 BinaryNumber: Integer PercentageNumber: Integer between 0 and 100 GradientNumber: Integer between 0 and 360

FAQs

Package last updated on 02 Mar 2023

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