Help on mpmath cplot

Python beginner. I am using mpmath.cplot for f(z) domain coloring. The doc says: "You can also supply a custom color function ( color ). This function should take a complex number as input and return an RGB 3-tuple containing floats in the range 0.0-1.0". But I have no idea how to translate this into code? Thx!

You can write a function that (I guess) sets the colour of each complex

def my_colour(z):
    # z is a complex number
    red = 0.1
    green = 0.5
    blue = 0.9
    return (red, green, blue)

That’s not a very good example, because every point will be coloured the
same. In a more useful example, the values of red, green, blue should
depend on the z value.

(1.0, 0.0, 0.0) would be a pure bright red, as bright as possible, with
no green or blue; (0.0, 0.0, 0.0) would be black (none of any colour)
and (1.0, 1.0, 1.0) would be pure white.

If you need to learn about the RGB colour space, you can start here:

Thx, I got it, will try!