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

husl

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

husl

Human-friendly HSL

  • 6.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2K
decreased by-56.15%
Maintainers
1
Weekly downloads
 
Created
Source

DEPRECATED

Identical functionality is provided under a new name: HSLuv.

Package: https://www.npmjs.com/package/hsluv Documentation: https://github.com/hsluv/hsluv/tree/master/javascript

Usage

husl.toHex(hue, saturation, lightness)

hue is a number between 0 and 360, saturation and lightness are numbers between 0 and 100. This function returns the resulting color as a hex string.

husl.toRGB(hue, saturation, lightness)

Like above, but returns an array of 3 numbers between 0 and 1, for the r, g, and b channel.

husl.fromHex(hex)

Takes a hex string and returns the HUSL color as array that contains the hue (0-360), saturation(0-100) and lightness(0-100) channel. Note: The result can have rounding errors. For example saturation can be 100.00000000000007

husl.fromRGB(red, green, blue)

Like above, but red, green and blue are passed as numbers between 0 and 1.

Use husl.p.toHex, husl.p.toRGB, husl.p.fromHex and husl.p.fromRGB for the pastel variant (HUSLp). Note that HUSLp does not contain all the colors of RGB, so converting arbitrary RGB to it may generate invalid HUSLp colors.

Keywords

FAQs

Package last updated on 16 Dec 2016

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