Skip to main content

A Pythonic library for creating beautiful, algorithmic color schemes.

Project description

PaintCan

PaintCan banner

Build Status Supports Python versions 3.11+

PaintCan is a high-quality, Pythonic library for working with HSBA colors and generating beautiful, algorithmic color schemes. It provides robust tools for color manipulation and harmony generation.

Features

  • HSBAColor: A value-type representation of color using Hue, Saturation, Brightness, and Alpha (0.0 - 1.0).
    • Cyclic Hue adjustment (wrapping).
    • Clamping and Overflow support for Saturation and Brightness.
    • Pythonic unpacking: h, s, b, a = color.
  • ColorScheme: A collection of colors generated by color theory rules.
    • Supports the Sequence protocol (len(scheme), scheme[0], iteration).
    • 8 factory methods for generating harmonious schemes:
      • Analogous
      • Accented Analogous
      • Complementary
      • Compound
      • Monochromatic
      • Shades
      • Split Complementary
      • Triadic

Installation

Using PDM:

pdm add paintcan

Using pip:

pip install paintcan

Usage

Working with HSBAColor

from paintcan import HSBAColor

# Create a color (Red)
red = HSBAColor(hue=0.0, saturation=1.0, brightness=1.0, alpha=1.0)

# Adjust Hue (wraps around)
orange = red.adjust_hue(0.08)

# Get the complement (Cyan-ish)
cyan = red.complement()

# Pythonic Unpacking
h, s, b, a = cyan
print(f"Hue: {h}, Saturation: {s}")

Generating Color Schemes

from paintcan import HSBAColor, ColorScheme

# Start with a base color
base = HSBAColor(0.5, 0.8, 0.9, 1.0) # Cyan-ish

# Generate a Split Complementary scheme
scheme = ColorScheme.from_split_complementary(base)

# Access colors (behaves like a tuple)
print(f"Scheme has {len(scheme)} colors.")
theme = scheme.theme_color # First color is always the theme color

for color in scheme:
    print(color)

Demo

To see the color schemes in action in your terminal (using ANSI colors):

# If installed via PDM/Dev
pdm run python -m paintcan

# If installed in your environment
python -m paintcan

License

This project is licensed under the MIT License - see the LICENSE file 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

paintcan-0.1.3.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

paintcan-0.1.3-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file paintcan-0.1.3.tar.gz.

File metadata

  • Download URL: paintcan-0.1.3.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for paintcan-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6b216021c2dc1bcc7ca5cc266adddc95a95df81ad911f2fa3145fbf989099075
MD5 aff16dd840e97ce4d8ceaac929a95ff1
BLAKE2b-256 34e2a805a09d0bda5bee1d1c124047d4ac570b42065434c245e3701ea236888f

See more details on using hashes here.

Provenance

The following attestation bundles were made for paintcan-0.1.3.tar.gz:

Publisher: python-publish.yml on btfranklin/paintcan

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file paintcan-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: paintcan-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for paintcan-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b7e925aaf4495cf555ccca82368fb4d444ef2d9906d5c96d6954b0c117ae937d
MD5 1d1e4158d565ce50c349a4b50e266b7d
BLAKE2b-256 0034a7a2e0ed5556b3516d5550b3b436a8681940477700a8a818c8428eed07c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for paintcan-0.1.3-py3-none-any.whl:

Publisher: python-publish.yml on btfranklin/paintcan

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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