Next / Previous / Contents / TCC Help System / NM Tech homepage

10.3. CMYModel.colorToParams()

Converting a Color instance to cyan, magenta, and yellow values is straightforward, as each of the CMY colors is the complement of the corresponding RGB colors stored in attributes of the Color instance. To complement a number in [0,MAX_PARAM], we subtract that number from MAX_PARAM.

huey
# - - -   C M Y M o d e l . c o l o r T o P a r a m s

    def colorToParams ( self, color ):
        """Convert a color to CMY parameters.
        """
        cyan     =  MAX_PARAM - color.r
        magenta  =  MAX_PARAM - color.g
        yellow   =  MAX_PARAM - color.b
        return (cyan, magenta, yellow)