Skip to main content

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)  # #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 generation
  • algorithm (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:

  1. Hashes the input text using SHA-256
  2. Converts hash to HSL color space
  3. Ensures vibrant colors by constraining saturation (70-100%) and lightness (50-65%)
  4. Converts to RGB and formats as hex

License

MIT License - see LICENSE.txt for details.

Project 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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autohex-0.1.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

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

Hashes for autohex-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cbcf8775bb3bc51f0ac24dcf39d7d6970d2804cf602f4c2338add341b68ab677
MD5 d5b011931702688b0cad4714272a028f
BLAKE2b-256 198fdc396cdf606f5aa939d8d9fee707c0079cc1768056d5e88072eb11ed2b86

See more details on using hashes here.

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

Hashes for autohex-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 732dbd2b6a4788a15659b7542a1f1c916ca5735f8a536ab67dacb60a1d25223b
MD5 03705ecbd3b8f281132c7814f2a00b47
BLAKE2b-256 297ca76be4095cebd5be4a41835afaeb1ff3ff15fe8dab83c406854d4072d18a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page