# Function that converts rgb color to CAM02-UCS coordinates

**URL:** <https://discourse.julialang.org/t/function-that-converts-rgb-color-to-cam02-ucs-coordinates/65822>\
**Category:** Visualization\
**Created:** [August 4, 2021, 3:59pm UTC](https://discourse.julialang.org/t/function-that-converts-rgb-color-to-cam02-ucs-coordinates/65822 "2021-08-04T15:59:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![empet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/empet/32/221303_2.png) [@empet](https://discourse.julialang.org/u/empet)\
**Post date:** [August 4, 2021, 3:59pm UTC](https://discourse.julialang.org/t/function-that-converts-rgb-color-to-cam02-ucs-coordinates/65822/1 "2021-08-04T15:59:00Z")

</div>

The state of the art perceptual uniform colormaps (matplotlib viridis, plasma, magma, inferno, cividis), all sequential cmocean and cmasher colormaps,  
and a few seaborn ones have linear lightness in the color appearance model CAM02-UCS, where a color is represented in cylindrical coordinates by J’(lightness), C’ (chroma}, H’(hue).  
My question: is there a Julia package that defines a conversion function from srgb and J’C’H’ and conversely?

---

<div class="post-metadata">

**Author:** ![blackeneth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blackeneth/32/10353_2.png) [@blackeneth](https://discourse.julialang.org/u/blackeneth)\
**Post date:** [August 4, 2021, 4:37pm UTC](https://discourse.julialang.org/t/function-that-converts-rgb-color-to-cam02-ucs-coordinates/65822/2 "2021-08-04T16:37:22Z")

</div>

[Colors.jl](https://github.com/JuliaGraphics/Colors.jl) and related packages

---

<div class="post-metadata">

**Author:** ![empet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/empet/32/221303_2.png) [@empet](https://discourse.julialang.org/u/empet)\
**Post date:** [August 4, 2021, 4:48pm UTC](https://discourse.julialang.org/t/function-that-converts-rgb-color-to-cam02-ucs-coordinates/65822/3 "2021-08-04T16:48:21Z")

</div>

I coudn’t find which one performs such a conversion. Could you please point out the function name?

---

<div class="post-metadata">

**Author:** ![kimikage](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kimikage/32/14534_2.png) [@kimikage](https://discourse.julialang.org/u/kimikage)\
**Post date:** [August 4, 2021, 5:27pm UTC](https://discourse.julialang.org/t/function-that-converts-rgb-color-to-cam02-ucs-coordinates/65822/4 "2021-08-04T17:27:10Z")

</div>

Colors.jl does not support the CAM02-UCS.

Of course it is possible to add it, but the number of parameters is so large that dedicated APIs would need to be designed.

Another concern is that the CAM02 is somewhat outdated.

---

<div class="post-metadata">

**Author:** ![empet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/empet/32/221303_2.png) [@empet](https://discourse.julialang.org/u/empet)\
**Post date:** [August 4, 2021, 5:47pm UTC](https://discourse.julialang.org/t/function-that-converts-rgb-color-to-cam02-ucs-coordinates/65822/5 "2021-08-04T17:47:03Z")

</div>

CAM02 was improved by CAM16, but besides a new version of Rainbow created in this space, all above mentioned colormaps we are using are perceptually uniform in CAM02, while CET and Scientific Colourmaps by Fabio Crameri are devised in a much older color space (more than 40), and obviously they are not uniform in CAM02.
