Networking colors with PUN

I have been able to get a cube to change color, but it is not showing over the network.
I put a photon view on the cube, and then had it observe the following script, which I also placed on the cube:

void Update() {
		if (Input.GetKeyDown(KeyCode.P)){
			gameObject.renderer.material.color = Color.magenta;
		}
		if (Input.GetKeyDown(KeyCode.B)){
			gameObject.renderer.material.color = Color.cyan;
		}
	}

it then tells me to use a photonserializeview, so I tried somehting like this:

  public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info){
    		if(stream.isWriting){
    			//send color
    		}
    		else{
    			//get color
    			
    		}

but I have no idea what needs to be done next. Am I on the right track? Thanks

Color synccolor;
Vector3 tempcolor;

void Update() {
                 if(!photonView.isMine){
                        gameObject.renderer.material.color = synccolor;
        		return;
                 }
        
                 if (Input.GetKeyDown(KeyCode.P)){
                     gameObject.renderer.material.color = Color.magenta;
                 }
                 if (Input.GetKeyDown(KeyCode.B)){
                     gameObject.renderer.material.color = Color.cyan;
                 }
             }
    
      public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info){
                 if(stream.isWriting){
                     //send color
                     tempcolor = new Vector3(gameObject.renderer.material.color.r,gameObject.renderer.material.color.g,gameObject.renderer.material.color.b);

                     stream.Serialize (ref tempcolor);
                 }
                 else{
                     //get color
                     stream.Serialize (ref tempcolor);

                     synccolor = new Color(tempcolor.x, tempcolor.y, tempcolor.z, 1.0f);
                     
                 }

Doing this consume messages per seconds, you can try Photon - Syncing object's color to all players? - Unity Answers

If the color does not change all that often, you can also use a player “Custom Property” to store the player’s color (skin, tools, etc). If you don’t send anything else, the use of OnPhotonSerializeView() is not the best option.

The PhotonPlayer class has SetCustomProperties(Hashtable propertiesToSet). The key can be any string (e.g. “c” because that’s shorter than “Color”) and the value can be either the Vector3 or an integer (leaner). Set your color in a room via PhotonNetwork.player and get everyone’s color by going through the player list PhotonNetwork.playerList (which includes the local player).

More on communication and storing values in the doc pages.