Paint A Rainbow On Your SolidWorks Assembly. Multi-Colored Macro Follow-up. - SolidSmack -
do you have a macro
If I am getting you correctly, you want to identify different parts with different colors in an assembly. I think, SolidWorks has provided an easy tool for that - Assembly Visualization. Sort your FeatureManagerTree by File Names. You can also see only top level or indented view as per your requirement.
The best part is you can also save it as a different display state.
2017 SOLIDWORKS Help - Assembly Visualization Tab
Retrieving data ...