How to change colour of player in a Network Multiplayer game?

How to change colour of player in a Network Multiplayer game?
My script to far is…

    using UnityEngine;
    using UnityEngine.Networking;
    using System.Collections;
    public class ChangeColor : NetworkBehaviour {
    	
    	public Color[] colors;
    
    	void Start()
    	{
    		GetComponent<Renderer>().material.color = colors[Random.Range(0, colors.Length)];
    	}
    }

When this is applied to the players, some people don’t see the same colour on their screen as they actually are. E.g player is actually red, but on another persons screen it is blue.

You randomize the colors on each machine separately I think.
What you want to do is to set the colors array with the same values on all machines, then you calculate the colors for the players on one single machine and distribute the information to the other players. You can use a dictionary which has the player(number) as key and the index of the assigned color from the colors array as value. After the one machine has calculated the colors for each player, you tell the players which color the are. You could send each player the color information and handle the information in a function:

void assignColorIndex(int colorIndex)
{
             GetComponent<Renderer>().material.color = colors[colorIndex];
         }

EDIT: actually all of your players have to know the color of the other players I think? so that the clients can visualize a player conistently in the same color over all machines, so after you calculated the color for each player on one machine, you send the dictionary which has the player number as key and the color index as value to each client, and the client then will have to set all player material colors according to the calculated dictionary information.