A package to do color conversions and comparisons
Project description
colortools
Python package for common color conversions and operations
Table of Contents
Description
Python package for conversions between common color representations like RGB and HEX and color comparisons using CIE formulas.
Features
Conversion between common color represantations
- RGB
- HEX
- CMYK
- HSL
- HSV
- LAB
- XYZ
- Color Name
Color difference calculation (Delta E)
measure of the perceptual difference between two colors
- Delta E (ΔE) CIE76 Formula
- Delta E (ΔE) CIE94 Formula
- Delta E (ΔE) CIEDE2000 Formula
Quickstart
Installation
To install from test PyPI with pip:
$ python -m pip install colortools-lentolen
Example usage:
Using colortools in a Python script to calculate the CIEDE200 difference between to hex colors.
from colortools import color_utils
color1 = color_utils.hex_to_rgb("#ddf4ee")
color2 = color_converter.hex_to_rgb("#88bfb1")
deltaE = color_utils.ciede2000_rgb(color1, color2)
Documentation
all color models are represented as tuples except hex codes: e.g: (255,255,255)
color conversion:
syntax example:
colortools.color_utils.hex_to_rgb(hex)
supported color models: rgb, hex, cmyk, hsl, hsv, lab, xyz, colorname
only hex codes can directly be converted to colornames. there are multiple color naming standards availabe: html (standard), html-ger, meodai, x11, color-meanings.com.
This is how you can for example use the meodai GitHub color name collection:
colortools.color_utils.hex_to_colorname("#ffffff", "meodai")
color difference:
CIE functions to calculate the Delta E difference between to colors (perceptual difference).
- ciede2000(lab1, lab2)
- ciede2000_rgb(rgb1, rgb2)
- cie76(lab1, lab2)
- cie76_rgb(rgb1, rgb2)
- cie94(lab1, lab2)
- cie94_rgb(rgb1, rgb2)
returns Delta E as float
License
colortools
is distributed under the terms of the MIT license.
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
Hashes for colortools_lentolen-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f738d7ada0af9d9293284c356c92b922b1ceba6c8bd4805e697b2f7739e272c0 |
|
MD5 | 611b096e678453f679c1b94f998faffe |
|
BLAKE2b-256 | 53727b7fd3fbd7de52bbe33ce3b7ade968456c7b9fa9be36cde2b47875ea049b |
Hashes for colortools_lentolen-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec068e8799e61383d1b2ef3deab280c7d26ef93771a95c628ed0c604230e188c |
|
MD5 | dfa0f41e88d8c2073fee153c4eb21af0 |
|
BLAKE2b-256 | d517f62918a8dc17ca39e095ba888430da176135740690f9a4214e6b1fe6a67b |