{"id":5958,"library":"hsluv","title":"HSLuv: Human-friendly HSL Color Space","description":"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.","status":"active","version":"5.0.4","language":"python","source_language":"en","source_url":"https://github.com/hsluv/hsluv-python","tags":["color","hsl","hsluv","hpluv","color-space","color-conversion"],"install":[{"cmd":"pip install hsluv","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"hsluv_to_hex","correct":"from hsluv import hsluv_to_hex"},{"symbol":"hex_to_hsluv","correct":"from hsluv import hex_to_hsluv"},{"symbol":"rgb_to_hsluv","correct":"from hsluv import rgb_to_hsluv"},{"symbol":"hsluv_to_rgb","correct":"from hsluv import hsluv_to_rgb"},{"symbol":"hpluv_to_hex","correct":"from hsluv import hpluv_to_hex"},{"symbol":"hex_to_hpluv","correct":"from hsluv import hex_to_hpluv"}],"quickstart":{"code":"from hsluv import hsluv_to_hex, hex_to_hsluv, rgb_to_hsluv, hsluv_to_rgb\n\n# Convert HSLuv to Hex\nhsluv_color = [240.0, 100.0, 50.0]  # Blue color (Hue, Saturation, Lightness)\nhex_code = hsluv_to_hex(hsluv_color)\nprint(f\"HSLuv {hsluv_color} -> Hex: {hex_code}\")\n\n# Convert Hex to HSLuv\nparsed_hsluv = hex_to_hsluv(\"#0000FF\") # Pure Blue\nprint(f\"Hex #0000FF -> HSLuv: {parsed_hsluv}\")\n\n# Convert RGB to HSLuv (RGB values 0-1)\nrgb_color = [0.0, 0.0, 1.0] # Pure Blue\nconverted_hsluv = rgb_to_hsluv(rgb_color)\nprint(f\"RGB {rgb_color} -> HSLuv: {converted_hsluv}\")\n\n# Convert HSLuv to RGB (RGB values 0-1)\nhsluv_to_rgb_example = [240.0, 100.0, 50.0] # Blue\nconverted_rgb = hsluv_to_rgb(hsluv_to_rgb_example)\nprint(f\"HSLuv {hsluv_to_rgb_example} -> RGB: {converted_rgb}\")","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade to Python 3.7+ or pin `hsluv` to a version compatible with Python 2 (e.g., `pip install hsluv==5.0.0`).","message":"Version 5.x and later require Python 3.7 or newer. Python 2 users must install `hsluv==5.0.0` or earlier versions for compatibility.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"For display or strict validation, consider rounding the output values to a desired precision or clamping them to their expected ranges after conversion.","message":"The library does not 'clamp' floating point errors, meaning output values for color components might be slightly outside their expected ranges (e.g., RGB values slightly less than 0 or greater than 1, or HSLuv components slightly out of range).","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always refer to the function signatures and documentation to provide inputs in the correct format and range.","message":"Ensure input types match function expectations. For example, `hsluv_to_rgb` expects hue (0-360), saturation (0-100), and lightness (0-100) as floats. `rgb_to_hsluv` expects R, G, B as floats between 0 and 1. Mis-matched types could lead to unexpected results or `TypeError`s.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'5.0.4':61 'activ':79 'allow':48 'altern':27 'avail':51 'built':33 'chroma':52 'cieluv':35 'color':6,22,39,74,85,90,93 'color-convers':92 'color-spac':89 'compon':46 'convers':94 'convert':65 'current':58 'develop':80 'extend':41 'friend':4,17 'function':63 'hexadecim':73 'hpluv':68,88 'hsl':5,18,30,86 'hsluv':1,8,67,87 'hue':19 'human':3,16 'human-friend':2,15 'implement':12 'librari':57 'light':21 'maintain':77 'pastel':69 'percentag':55 'perceptu':37 'period':83 'provid':62 'python':11 'represent':75 'rgb':71 'satur':20,45 'space':7,23,40,91 'span':49 'standard':29 'status':81 'uniform':38 'updat':84 'upon':34 'variant':70 'version':60","created_at":"2026-04-14T18:35:49.166224+00:00","updated_at":"2026-04-16T15:35:49.969445+00:00","problems":[{"fix":"pip install hsluv","cause":"The 'hsluv' library is not installed in the current Python environment or the Python interpreter cannot locate it.","error":"ModuleNotFoundError: No module named 'hsluv'"},{"fix":"Ensure you pass a single list or tuple as the argument, for example: `hsluv_to_rgb([hue, saturation, lightness])`.","cause":"The `hsluv_to_rgb` and similar conversion functions expect a single iterable (list or tuple) containing three float values for color components (e.g., hue, saturation, lightness), but received separate arguments.","error":"TypeError: hsluv_to_rgb() takes 1 positional argument but 3 were given"},{"fix":"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]`.","cause":"The `hsluv` library, by design, does not clamp floating-point errors, which can result in RGB components (and other color space values) being slightly outside their expected ranges (e.g., RGB values slightly less than 0 or greater than 1).","error":"hsluv rgb returns negative values"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"5.0.4","cli_name":"","cli_version":null,"type":"library","homepage":"https://www.hsluv.org","github":"https://github.com/hsluv/hsluv-python","docs":null,"changelog":null,"pypi":"https://pypi.org/project/hsluv/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":null}}