Skip to content

bjoernenders/husl-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Package Version

A fork of the Python implementation of HUSL (revision 3).

This fork uses numpy instead of math for calcution and accepts numpy arrays for the color channels. Original scalar functions are still available but prefixed with sc. Ideal would be to reimplement them as numpy ufuncts using C.

Installation

pip install husl or python setup.py install --user

Usage

husl_to_hex(hue, saturation, lightness)

hue is a float between 0 and 360, saturation and lightness are floats or numpy arrays between 0 and 100. This function returns the resulting color as a hex string.

husl_to_rgb(hue, saturation, lightness)

Like above, but returns a list of 3 floats or arrays between 0 and 1, for each RGB channel.

rgb_to_husl(red, green, blue)

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

For HUSLp (the pastel variant), use huslp_to_hex, huslp_to_rgb, hex_to_huslp and rgb_to_huslp.

complex_to_rgb(z, amin, amix, mode='special', ...)

Converts complex array to an RGB representation, mapping phase to hue and modulus to some form of lightness, depending on the chosen mode. For detailed paramter description, look at the docs of the function

Testing

Run python setup.py test.

Authors

About

Python implementation of HUSL (revision 3)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%