HSLuv is a Python implementation of a human-friendly HSL (Hue, Saturation, Lightness) color space, which is an alternative to standard HSL. It's built upon CIELUV, a perceptually uniform color space, extending it with a saturation component that allows spanning all available chroma as a percentage. The library, currently at version 5.0.4, provides functions for converting between HSLuv, HPLuv (pastel variant), RGB, and hexadecimal color representations. It maintains an active development status with periodic updates.
pip install hsluvVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use the core conversion functions of the `hsluv` library to transform colors between HSLuv, hexadecimal, and RGB formats. HSLuv takes hue (0-360), saturation (0-100), and lightness (0-100). RGB input/output values are floats between 0 and 1.
Upgrade to Python 3.7+ or pin `hsluv` to a version compatible with Python 2 (e.g., `pip install hsluv==5.0.0`).
For display or strict validation, consider rounding the output values to a desired precision or clamping them to their expected ranges after conversion.
Always refer to the function signatures and documentation to provide inputs in the correct format and range.
pip install hsluv
Ensure you pass a single list or tuple as the argument, for example: `hsluv_to_rgb([hue, saturation, lightness])`.
Manually clamp or round the output values to their expected ranges after conversion. For example, for RGB components: `rgb_clamped = [max(0.0, min(1.0, c)) for c in rgb_raw]`.
No dependency data recorded yet.