Skip to main content

A color library for Python.

Project description

Donate via PayPal Discord Build Coverage Status PyPI Version PyPI Downloads PyPI - Python Version License

ColorAide Extras

A place to house uncommon and experimental color spaces, ∆E methods, and gamut mapping methods not currently intended for the main ColorAide repository.

Some may be quite polished, and some may be a work in progress.

Requires ColorAide to already be installed:

$ pip install coloraide_extras

You can either cherry pick plugins you want:

>>> from coloraide import Color as Base
>>> from coloraide_extras.spaces.hunter_lab import HunterLab
>>> class Color(Base):
... 
>>> Color.register(HunterLab)
>>> Color('red').convert('hunter-lab')
color(--hunter-lab 46.113 82.694 28.337 / 1)

Or just use the provided color class that includes all the default ColorAide color spaces, plus the extras!

>>> from coloraide_extras import Color
>>> Color('red').convert('hunter-lab')
color(--hunter-lab 46.113 82.694 28.337 / 1)

Spaces

CMY

>>> Color('red').convert('cmy')
color(--cmy 0 1 1 / 1)

The CMY color model is a subtractive color model in which cyan, magenta and yellow pigments or dyes are added together in various ways to reproduce a broad array of colors. The name of the model comes from the initials of the three subtractive primary colors: cyan, magenta, and yellow.

Learn more.

CMY

CMYK

>>> Color('red').convert('cmyk')
color(--cmyk 0 1 1 0 / 1)

Similar to the CMY model and is used in the printing industry. CMYK is usually a calibrated model. The ColorAide model is a simple naive representation.

CMYK refers to the four inks used in some color printing: cyan, magenta, yellow, and key. It uses K, black ink, since C, M, and Y inks are translucent and will only produce a gray color when laid on top of each other.

Learn more.

xyY

>>> Color('red').convert('xyy')
color(--xyy 0.64 0.33 0.21264 / 1)

A derivative of this XYZ space, the CIE xyY color space, is often used as a way to graphically present the chromaticity of colors.

xyY

Learn more.

CIE 1960 UCS

>>> Color('red').convert('ucs')
color(--ucs 0.27493 0.21264 0.12243 / 1)

The CIE 1960 color space ("CIE 1960 UCS", variously expanded Uniform Color Space, Uniform Color Scale, Uniform Chromaticity Scale, Uniform Chromaticity Space) is another name for the (u, v) chromaticity space devised by David MacAdam. The color space is implemented using the relation between this space and the XYZ space as coordinates U, V, and W.

UCS

Learn more

CIE 1964 UVW

>>> Color('red').convert('uvw')
color(--uvw 171.8 24.715 52.261 / 1)

Wyszecki invented the UVW color space in order to be able to calculate color differences without having to hold the luminance constant. He defined a lightness index W* by simplifying expressions suggested earlier by Ladd and Pinney, and Glasser et al.. The chromaticity components U* and V* are defined such that the white point maps to the origin, as in Adams chromatic valence color spaces.

What's with all the weird negative black values at the bottom? :shrug:

The algorithm is simple enough that it is unlikely that we are wrong, but more the color space was not designed in such a way to render nicely but to focus mainly on the distancing requirement.

UVW

Learn more.

HSI

>>> Color('red').convert('hsi')
color(--hsi 0 1 0.33333 / 1)

The HSI model is similar to models like HSL and HSV except that it uses I for intensity instead of Lightness or Value. It does not attempt to "fill" a cylinder by its definition of saturation leading to a very different look when we plot it.

HSI

HSI Slice

Learn more.

Prismatic

>>> Color('red').convert('prismatic')
color(--prismatic 1 1 0 0 / 1)

The Prismatic model introduces a simple transform of the RGB color cube into a light/dark dimension and a 2D hue. The hue is a normalized (barycentric)triangle with pure red, green, and blue at the vertices, often called the Maxwell Color Triangle. Each cross section of the space is the same barycentric triangle, and the light/dark dimension runs zero to one for each hue so the whole color volume takes the form of a prism.

Prismatic

Learn more.

Hunter Lab

>>> Color('red').convert('hunter-lab')
color(--hunter-lab 46.113 82.694 28.337 / 1)

The Hunter Lab color space, defined in 1948 by Richard S. Hunter, is another color space referred to as "Lab". Like CIELAB, it was also designed to be computed via simple formulas from the CIEXYZ space, but to be more perceptually uniform than CIEXYZ. Hunter named his coordinates L, a, and b. The CIE named the coordinates for CIELAB as L*, a*, b* to distinguish them from Hunter's coordinates.

Hunter Lab

Learn more.

RLAB

>>> Color('red').convert('rlab')
color(--rlab 51.012 79.742 57.26 / 1)

The RLAB color-appearance space was developed by Fairchild and Berns for cross-media color reproduction applications in which images are reproduced with differing white points, luminance levels, and/or surrounds.

RLAB

Learn more.

IPT

>>> Color('red').convert('ipt')
color(--ipt 0.45616 0.44282 0.62086 / 1)

Ebner and Fairchild addressed the issue of non-constant lines of hue in their color space dubbed IPT. The IPT color space converts D65-adapted XYZ data (XD65, YD65, ZD65) to long-medium-short cone response data (LMS) using an adapted form of the Hunt–Pointer–Estevez matrix (MHPE(D65)).

The IPT color appearance model excels at providing a formulation for hue where a constant hue value equals a constant perceived hue independent of the values of lightness and chroma (which is the general ideal for any color appearance model, but hard to achieve). It is therefore well-suited for gamut mapping implementations.

IPT

Learn more.

IgPgTg

>>> Color('red').convert('igpgtg')
color(--igpgtg 0.54834 0.15366 0.43674 / 1)

IgPgTg uses the same structure as IPT, an established hue-uniform color space utilized in gamut mapping applications. While IPT was fit to visual data on the perceived hue, IGPGTG was optimized based on evidence linking the peak wavelength of Gaussian-shaped light spectra to their perceived hues.

IgPgTg

Learn more.

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

coloraide_extras-0.3.0.post1.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

coloraide_extras-0.3.0.post1-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file coloraide_extras-0.3.0.post1.tar.gz.

File metadata

File hashes

Hashes for coloraide_extras-0.3.0.post1.tar.gz
Algorithm Hash digest
SHA256 a03c49d1f59f446e86dabf74c9b5f49b3fc851d5432826f6177f6706dccec7a1
MD5 3808089540c9138ac11af90a7bec6b38
BLAKE2b-256 ae6a72c4f101fbf2d89aad966390acd8b9e0e67e6e9c3a498005489fac79d909

See more details on using hashes here.

File details

Details for the file coloraide_extras-0.3.0.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for coloraide_extras-0.3.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 79ab3f9ace5fe71f3ecb94aaef5a7382a4c69d9a4082c96ea629e9893129bfc9
MD5 6cd471166900d6228e8b6358b52131b3
BLAKE2b-256 19c9ea6e77aabb5ce82205a270b2f691c4efdc770995f4ed2bb2e2001f84348c

See more details on using hashes here.

Supported by

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