Uniform colors, no. Which I find odd since there is (in most rule sets) a rule about the pitcher’s glove not being able to contain the color of the ball.
However ... a pitcher cannot wear any item that is deemed distracting. I would definitely say pants the same color as the ball are distracting in that they interfere with the batter’s ability to pick up the ball on delivery. Since team uniforms must (I use that term loosely) match, nobody would be able to wear them.
That said, those pants don’t appear the same color as the ball. It would be an umpire’s call if they are close enough to be distracting.