Next / Previous / Contents / Shipman's homepage

10.2. CMYModel.paramsToColor()

This method takes a triple (c, m, y) containing the three CMY parameters of a color, and returns the equivalent color as a Color instance.

# - - -   C M Y M o d e l . p a r a m s T o C o l o r

    def paramsToColor ( self, params ):
        """Convert CMY parameters to a Color.

Each parameter is the complement of one of the RGB colors: cyan is opposite red, magenta is opposite green, and yellow is opposite blue. Mathematically, we can convert a value by subtracting it from MAX_PARAM.

        cyan, magenta, yellow  =  params
        red    =  MAX_PARAM - cyan
        green  =  MAX_PARAM - magenta
        blue   =  MAX_PARAM - yellow
        return  Color ( red, green, blue )