# Color modeling problem up for grabs

**URL:** <https://discourse.processing.org/t/color-modeling-problem-up-for-grabs/15150>\
**Category:** Summer of Code\
**Created:** [November 2, 2019, 3:40pm UTC](https://discourse.processing.org/t/color-modeling-problem-up-for-grabs/15150 "2019-11-02T15:40:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![earthbound](https://avatars.discourse-cdn.com/v4/letter/e/8c91f0/32.png) [@earthbound](https://discourse.processing.org/u/earthbound)\
**Post date:** [November 2, 2019, 3:40pm UTC](https://discourse.processing.org/t/color-modeling-problem-up-for-grabs/15150/1 "2019-11-02T15:40:54Z")

</div>

In [a recent post](https://discourse.processing.org/t/changing-webcam-pixels-to-nearest-color-from-color-palette-array/14811), someone got at a common but [notoriously difficult](https://www.alanzucconi.com/2015/09/30/colour-sorting/) problem: color comparison and sorting.

The things is, if you use the most advanced color model (which virtually no one is), this is a lot easier.

CIECAM02 models color perception and comparison (for humans) better than any other model.

I found a Python library that has a compare function in that color model, and wrote a script that sorts colors via that model. The results are better than using any other model I’ve seen.

Here’s [a link to the script](https://github.com/earthbound19/_ebDev/blob/master/scripts/imgAndVideo/RGBhexColorSortIn2CIECAM02.py). Here’s [the library it uses](https://pypi.org/project/colorspacious/). Here is a before and after image generated from a palette list before and after sorting via the script.

 ![unsorted marker palette](http://earthbound.io/blog/wp-content/uploads/PrismacolorMarkers_RND_sort.png "unsorted marker palette")

 ![marker palette sorted by nearest next colro in CIECAM02 space](http://earthbound.io/blog/wp-content/uploads/PrismacolorMarkers_CIECAM02_sort.png "marker palette sorted by nearest next colro in CIECAM02 space")

I would love for such color comparisons to be available via a Processing library, and I want to suggest here, for anyone looking for a coding project, that this would be a worthy library to code 🙂
