A Pythonic library for creating beautiful, algorithmic color schemes.
Project description
PaintCan
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
- Supports the Sequence protocol (
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
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 paintcan-0.1.0.tar.gz.
File metadata
- Download URL: paintcan-0.1.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb48d100f477e0b46f10602233d8bbc3d53ef2911f569b704d961eb128d05aa9
|
|
| MD5 |
3c5716c0ebed96e4c9693d4e9cc979a0
|
|
| BLAKE2b-256 |
aaaef11c8b28d797158ab999430b8d31d1695263c18b48c88616ff3210fe5d65
|
Provenance
The following attestation bundles were made for paintcan-0.1.0.tar.gz:
Publisher:
python-publish.yml on btfranklin/paintcan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
paintcan-0.1.0.tar.gz -
Subject digest:
bb48d100f477e0b46f10602233d8bbc3d53ef2911f569b704d961eb128d05aa9 - Sigstore transparency entry: 768286482
- Sigstore integration time:
-
Permalink:
btfranklin/paintcan@573df6c44ebd7d1049042c625989b1f249c7f251 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/btfranklin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@573df6c44ebd7d1049042c625989b1f249c7f251 -
Trigger Event:
release
-
Statement type:
File details
Details for the file paintcan-0.1.0-py3-none-any.whl.
File metadata
- Download URL: paintcan-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57ff5ca216ed15d3dc873587662246809e02870b074c759ec4caf162363a45d5
|
|
| MD5 |
a04ca0ad38686cd1aa9e34d0c272f441
|
|
| BLAKE2b-256 |
03821131782710d42855dbc36a1c65362478c613b9e8fa5c2bdc4a1adae3a2d8
|
Provenance
The following attestation bundles were made for paintcan-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on btfranklin/paintcan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
paintcan-0.1.0-py3-none-any.whl -
Subject digest:
57ff5ca216ed15d3dc873587662246809e02870b074c759ec4caf162363a45d5 - Sigstore transparency entry: 768286492
- Sigstore integration time:
-
Permalink:
btfranklin/paintcan@573df6c44ebd7d1049042c625989b1f249c7f251 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/btfranklin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@573df6c44ebd7d1049042c625989b1f249c7f251 -
Trigger Event:
release
-
Statement type: