It must be possible - the port context menus have color to help with cable management. Have a look at the VCV source code to see how it is handled there. Maybe that can get you started.
Didn’t know about that new menu class. I guess I need to read the Release notes more carefully :-).
Previous to 2.4 I implemented a menu-driven color picker with swatches in pachde One Copper and related modules. These are free open source for anyone interested, of course.