Generate unique and vibrant hex color codes from text.
Project description
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) # #7c5ab8
# Use a seed for consistent variations
seeded_generator = AutoHex(seed="my-project")
color = seeded_generator.gen("hello world")
print(color) # Different color due to seed
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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.0.tar.gz.
File metadata
- Download URL: autohex-0.1.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d11dcb4dc92cc3de6787c1231c7dbe01223fd7946d3d61c6c1e647a6f92d0c0
|
|
| MD5 |
2686540d6665fc059d6eb0e0c3902fb3
|
|
| BLAKE2b-256 |
3da2f36b9d2984e131d33e80bb9d604a9d3c0c5ae17e0e43678b134a94bf60dc
|
File details
Details for the file autohex-0.1.0-py3-none-any.whl.
File metadata
- Download URL: autohex-0.1.0-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 |
0f7d4cc2bb48ff401299ea5ca10c44fe5865475dd85cb687e877f42e74fee04c
|
|
| MD5 |
06a4187945e55c74a3ec1081ae72166e
|
|
| BLAKE2b-256 |
107df59bd16b488b31e2e7a851fcea13674fe731f4e0321128b4a6c43d6f2817
|