Skip to main content

Build Status Package Version PyPI Downloads

A Python implementation of HSLuv (revision 4).

Installation

pip install hsluv

Python 2 users: pip install hsluv==5.0.0

Usage

This library does not hide (clamp) floating point error, e.g. you might receive a value outside of the expected range. If you wish to display the outputs of this library, consider rounding them for your purpose. The floating point error has not been quantified, but at least 10 decimal digits should be free of it.

hsluv_to_hex([hue, saturation, lightness])

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

hsluv_to_rgb([hue, saturation, lightness])

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

hex_to_hsluv(hex)

Takes a hex string and returns the HSLuv color as a list of floats as defined above.

rgb_to_hsluv([red, green, blue])

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

For HPLuv (the pastel variant), use hpluv_to_hex, hpluv_to_rgb, hex_to_hpluv and rgb_to_hpluv.

Testing

Run python -m unittest discover -v.

Publishing to PyPI

  • On PyPI, open the hsluv project's Manage → Publishing page and configure a GitHub Trusted Publisher: owner hsluv, repository hsluv-python, workflow publish.yml.
  • Update __version__ in hsluv.py to an unused version (e.g. 5.0.5rc1 for a pre-release) and push the commit to the branch you want to publish.
  • Open Actions → Publish to PyPI → Run workflow, select that branch, and run it to build and upload to production PyPI. No tag or GitHub release is needed.
  • Verify the release on PyPI. Published versions cannot be reused.

Authors

Metadata

Release files for hsluv 5.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hsluv 5.0.5
File Size Uploaded Provenance
hsluv-5.0.5.tar.gz 541.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hsluv 5.0.5
File Interpreter ABI Platform
hsluv-5.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 547.2 kB

Release files / hsluv-5.0.5.tar.gz

Download URL hsluv-5.0.5.tar.gz
Size 541.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fe9891df52ff78ddc9fc9cdba0fd0de49a4378d41e30a3901a1d716ec0c14163
BLAKE2b-256 checksum
How to use checksums
c76f139a4b35fa329a855d3a2af2f8e1351b133bca13a3fa2731bbd8a5273f95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / hsluv-5.0.5-py3-none-any.whl

Download URL hsluv-5.0.5-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ac1caa7837ad0ca94b48a574a19778f2303fce7f4a34ce5eafe751a40ec143db
BLAKE2b-256 checksum
How to use checksums
6ef284ae3176b3ccbc26ed470d599499c85170d378bf27bfd2db6aa9eaff7d98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for hsluv 5.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hsluv-5.0.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page