Maximum weight matching with classes of edges in a multi-edge bipartite graph
Your problem is closely related to the so-called &quot;Exact red-blue bipartite matching&quot; problem, see for instance http://lemon.cs.elte.hu/egres/open/Exact_matching_in_red-blue_bipartite_graphs.

The case with two colors is unlikely to be NP-hard, since it is known to belong to RNC$^2$.
I think that this randomized result can be translated to your problem.

The case where the number of colors is part of the input is NP-hard,
and this hardness argument easily transfers to your problem.