Yes you can do this with Ilogic. What you need to make sure is that spell corrently ( that make it easy anyway). I do not have at code you need 100 % but here is some code that might give you some idear(for assembly first code) and Part second code.
You can also make it color all view. but I have try to copy and paste as lillte code I could in a short time ... hope it help
//assembly
Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisDoc.Document
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = oAsmDoc.ComponentDefinition
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
Component.Color(oOccurrence.name)="RAL 5003 Sapphire blue"
iLogicVb.UpdateWhenDone = True
Next
End if
End Sub
Sub Colour1
Dim oPartDoc As PartDocument
Try
oPartDoc = ThisApplication.ActiveDocument
Catch
oPartDoc = ThisDoc.Document
End Try
'define the appearance library
Dim oLib As AssetLibrary
oLib = ThisApplication.AssetLibraries("KallesoeMaterialLibrary")
'make sure colors are in assembly doc
Dim libAsset As Asset
libAsset = oLib.AppearanceAssets.Item("RAL 9010 Pure white")
Dim localAsset As Asset
Try
localAsset = oPartDoc.Assets.Item("RAL 9010 Pure white")
Catch
localAsset = libAsset.CopyTo(oPartDoc)
End Try
oPartDoc.ActiveAppearance = localAsset
End Sub