You can use the partDocument.ActiveAppearance to set the color/appearance for a part, use the PartDocument.AppearanceAssets get find an appearance asset to set the ActiveAppearance.
Hope this helps.
If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.
Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.