Skip to main content

A package to do color conversions and comparisons

Project description

colortools

Python package for common color conversions and operations

PyPI - Version PyPI - Python Version


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 representations

  • 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 PyPI with pip:

$ python -m pip install colortools-lentolen

Example usage:

Using colortools in a Python script to calculate the CIEDE200 difference between two hex colors.

from colortools import color_utils
color1 = color_utils.hex_to_rgb("#ddf4ee")
color2 = color_utils.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

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

colortools_lentolen-0.0.5.tar.gz (304.0 kB view details)

Uploaded Source

Built Distribution

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

colortools_lentolen-0.0.5-py3-none-any.whl (305.2 kB view details)

Uploaded Python 3

File details

Details for the file colortools_lentolen-0.0.5.tar.gz.

File metadata

  • Download URL: colortools_lentolen-0.0.5.tar.gz
  • Upload date:
  • Size: 304.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for colortools_lentolen-0.0.5.tar.gz
Algorithm Hash digest
SHA256 180734197c5b33a29c4582cbae980b425573fab102b4194d8a681f12882a8104
MD5 b83a419257d97610480b3490d420a519
BLAKE2b-256 d0073f4cbf131514b70086ce7deb64e834eaf5e267497d1a27e6ea01ebfe7f29

See more details on using hashes here.

File details

Details for the file colortools_lentolen-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for colortools_lentolen-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 29662331297838e92c9ce15facba55e048121899a18e92490ac3fd8bacf0e80d
MD5 a552ae190a0bc8d6159a80622b82d30e
BLAKE2b-256 a1e1eaf2bc331d601587019ba28dcd00fa9c9a55f1e2a90f3f47ad266e9b9397

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