ijlyttle / colorpath

Build Color Paths
https://ijlyttle.github.io/colorpath
Other
0 stars 0 forks source link

maximum chroma #46

Closed ijlyttle closed 3 years ago

ijlyttle commented 3 years ago

We will need to determine, for a given color space, the extent of the RGB gamut.

# returns `logical`
pth_in_gamut <- function(color) 

# returns `double`, max chroma given luminance and hue, in provided color space
pth_max_chroma <- function(mat) 

# returns object of same type, with out-of-gamut colors replaced with max-chroma colors
pth_clip_chroma <- function(color) 

We could also use an internal function:

# returns `double`, negative means inside gamut, positive means outside
x_gamut <- function(color)
ijlyttle commented 3 years ago

It sees like pth_max_chroma()will be where the action is. This will be a root-finding problem using x_gamut(); it will be easiest for me to sketch out what happens for a single color.

This has the potential to become an expensive operation; perhaps we will use it sparingly.