# Mathematical Optimization – Using Maximize with LABColor

I write a function that, from a color, returns a contrasting color. It does this by maximizing the `ColorDistance` between the colors of entry and exit. However, I get an error that complains about how `LabColor[l, a, b]` is symbolic and not a color, whether it's up to `Maximize` gives it a numeric value (and finally finds a contrasting color). What should I do to `LabColor` to stop this error?

(Note that I do not think this contrast color scheme is particularly effective, I just want to know how to fix this error for general knowledge)

``````(* RGB space limits in the LAB space *)
rgbCube = cuboid[{0, -0.8, -1.13}, {1, 0.94, 0.94}];

(* Find a very contrasting color *)
Maximize[
ColorDistance[RoseLABColor[PinkLABColor[RoseLABColor[PinkLABColor[l, a, b]], {l, a, b} [Element]
rgbCube]
``````
``````ColorDistance: Pink and LABColor[l, a, b] must be two valid color guidelines, images or lists of objects of the same size.
``````
``````Outside[1]= {2.00573, {l -> 0., a -> -0.8, b -> -1, 13}}
``````