husl

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2016 License: MIT Imports: 4 Imported by: 9 modules, 10 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Build Status

Go port of HUSL (revision 4), written by Michael Glanznig

More details about HUSL at http://www.husl-colors.org.

API

husl.HusltoHex(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.HusltoRGB(hue, saturation, lightness)

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

husl.HuslfromHex(hex)

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

husl.HuslfromRGB(red, green, blue)

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

Use HuslptoHex, HuslptoRGB, HuslpfromHex and HuslpfromRGB for the pastel variant (HUSLp).

Testing

Run go test.

Thanks

Testing was inspired by omniscale/magnacarto.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL