Skip to main content

Hued

Python Version Code Size Downloads License Compliance PyPI Version

An open-source Python library for color generation, conversion, and retrieval of common properties, palettes, and color information.

Changes in version 1.0.7:

  • 2 new functions in hued.analysis for testing color visibility and quality, and simulating color blindness.

Changes in version 1.0.6:

  • New functions under ColorPalette to create gradients and to export ColorPalette data as a CSV, TXT or JSON file.

Changes in version 1.0.5:

  • New conversion methods for XYZ / CIE 1931 XYZ.

Changes in version 1.0.4:

  • Updated colors.py with 500+ new color names to map to.

Changes in version 1.0.3:

  • Created new functions for the analiysis module. Including rgb_to_linear, and other functions to return more color properties, like luminance and vibrancy. We've also added new functions to calculate the color contrast ratio between to colors, and an accessibility function to return if foreground text color should be light, or dark, based on the background color.
  • Created a new blend_colors function in our conversions module, to blend 2 RGB colors based on a given ratio. Also created new color conversion functions to convert each format into another target format, instead of just RGB.
  • Added 3 more color schemes to palettes. Created new functions under the ColorPalette class, for random color generation, and a batch HEX color generation function.

Installation

You can install Hued using pip:

pip install hued

Supported Python Versions

Hued supports the following Python versions:

  • Python 3.6
  • Python 3.7
  • Python 3.8
  • Python 3.9
  • Python 3.10
  • Python 3.11 or later

Please ensure that one of these Python versions is installed before using Hued. Hued may not work as expected on lower versions of Python than the supported.

Features

  • Color Generation: Generate random colors and palettes.
  • Color Conversion: Convert between different color formats (RGB, HEX, HSL, etc.).
  • Color Properties: Retrieve properties like brightness, temperature, and whether a color is muted, pastel, or vibrant.
  • Color Names: Get relevant color names, based on HEX values, and convert between color names and HEX values.

Usage

Color Properties

from hued.colors import ColorManager

# Initialize the color manager
color_manager = ColorManager()

# Generate a random color
colorBlue = color_manager.get_color_by_name("Blue");

print("Blue Hex:", colorBlue.get("Hex"));

You can view more properties by going to Hued's package documentation

Color Conversion

from hued.conversions import hex_to_rgb, rgb_to_hsl

# Convert HEX to RGB
rgb_color = hex_to_rgb("FF0000"); # Red
print(f"Hex to RGB: {rgb_color}")

# Convert RGB to HSL
hsl_color = rgb_to_hsl(255, 0, 0) # Red
print(f"RGB to HSL: {hsl_color}")

Color Analysis

from hued.analysis import get_temperature, is_pastel

# Check if a color is a pastel color
pastel_color = (255, 200, 200)  # Example pastel color
is_pastel = is_pastel(pastel_color)
print(f"Is Pastel: {is_pastel}")

# Check if a color is vibrant
warm_color = (255, 0, 0)  # Example warm color
temperature = get_temperature(warm_color)
print(f"The current color is: {temperature}") # Warm

Color Generation and Palettes

from hued.palettes import ColorPalette

base_color = (255, 60, 52)  # Red

# Initialize the ColorPalette with a base color (RGB)
palette = ColorPalette(base_color)

# Get the complementary color
complementary = palette.generate_complementary()
print(f"Complementary color of {base_color}: {complementary}")

# Generate a random palette, with calculated color schemes, and base color
random_palette = palette.generate_random_palette()
print(f"Generated color palette's base color: {random_palette.get('Base Color')}")

More functions are available for the ColorPalette class, including converting all contained colors to Hex colors.

Contributing

Contributions are welcome! If you encounter any issues, have suggestions, or want to contribute to Hued, please open an issue or submit a pull request on GitHub.

License

Hued is released under the terms of the MIT License (Modified). Please see the LICENSE file for the full text.

Modified License Clause

The modified license clause grants users the permission to make derivative works based on the Hued software. However, it requires any substantial changes to the software to be clearly distinguished from the original work and distributed under a different name.

By enforcing this distinction, it aims to prevent direct publishing of the source code without changes while allowing users to create derivative works that incorporate the code but are not exactly the same.

Please read the full license terms in the LICENSE file for complete details.

Metadata

Release files for hued 1.0.7

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

Source distribution (sdist)

Source distribution for hued 1.0.7
File Size Uploaded Provenance Actions
hued-1.0.7.tar.gz 30.8 kB Without provenance Details for hued-1.0.7.tar.gz

Built distribution (wheel)

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

Total release size: 60.9 kB

Release files / hued-1.0.7.tar.gz

Download URL hued-1.0.7.tar.gz
Size 30.8 kB
Tags Source
SHA-256 checksum
How to use checksums
de6dcd11ca92d3570ef441987892c3c02ec258acff948e687b2dc08a9994877b
BLAKE2b-256 checksum
How to use checksums
9feadc36a977dca620628157acee810eb2f39c63cd7b70fbdd4af568fc18f191
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / hued-1.0.7-py3-none-any.whl

Download URL hued-1.0.7-py3-none-any.whl
Size 30.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4f72037c04beaf583762619f32c1f090dda7dd6b6f6f2325a47df4f65d0124a
BLAKE2b-256 checksum
How to use checksums
9b223aca59825e90298c807c46c1a9622c1664da15fce72156a3a532bcde630a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for hued 1.0.7

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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