AutoHex
Generate unique and vibrant hex color codes from text using deterministic hashing.
Features
- Deterministic: Same input text always produces the same color
- Vibrant Colors: Uses HSL color space to generate visually appealing colors
- Customizable: Support for seeding and different algorithms
- Lightweight: No external dependencies
Installation
pip install autohex
Quick Start
from autohex import AutoHex
# Create an instance
generator = AutoHex()
# Generate a hex color from text
color = generator.gen("hello world")
print(color) # #664df9
# Use a seed for consistent variations
seeded_generator = AutoHex(seed="my-project")
color = seeded_generator.gen("hello world")
print(color) # #ec5915
API Reference
AutoHex(seed=None, algorithm='vibrant_hsl')
Creates a new color generator instance.
Parameters:
seed(str, optional): A seed string to influence color generationalgorithm(str): Color generation algorithm (currently only 'vibrant_hsl')
gen(text: str) -> str
Generates a hex color code from the input text.
Parameters:
text(str): Input text to generate color from
Returns:
str: Hex color code (e.g., '#7c5ab8')
Algorithm
The vibrant_hsl algorithm:
- Hashes the input text using SHA-256
- Converts hash to HSL color space
- Ensures vibrant colors by constraining saturation (70-100%) and lightness (50-65%)
- Converts to RGB and formats as hex
License
MIT License - see LICENSE.txt for details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
autohex-0.1.1.tar.gz
(3.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autohex-0.1.1.tar.gz.
File metadata
- Download URL: autohex-0.1.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbcf8775bb3bc51f0ac24dcf39d7d6970d2804cf602f4c2338add341b68ab677
|
|
| MD5 |
d5b011931702688b0cad4714272a028f
|
|
| BLAKE2b-256 |
198fdc396cdf606f5aa939d8d9fee707c0079cc1768056d5e88072eb11ed2b86
|
File details
Details for the file autohex-0.1.1-py3-none-any.whl.
File metadata
- Download URL: autohex-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
732dbd2b6a4788a15659b7542a1f1c916ca5735f8a536ab67dacb60a1d25223b
|
|
| MD5 |
03705ecbd3b8f281132c7814f2a00b47
|
|
| BLAKE2b-256 |
297ca76be4095cebd5be4a41835afaeb1ff3ff15fe8dab83c406854d4072d18a
|