p5.party shared objects can share simple data objects, but can’t store custom object types like p5.File, p5.Image, p5.Color or p5.Vector. If your code is working with p5.Color objects or p5.Vector values you can share the important values if you convert them to simple data types first.

Sharing p5.Color Objects

// p5.Color objects can't be shared directly
const randomColor = color(random(255), random(255), random(255));

// but you can convert p5.Color objects to strings for sharing
shared.color = randomColor.toString();

// p5 functions that take color arguments can also accept
// the color description strings
fill(shared.color);
stroke(shared.color);

// you can turn the string back into a color object too, if you need to
const myColor = color(shared.color);
const darkColor = lerpColor(myColor, color("black"), .5);

Sharing p5.Vector Objects

// p5.Vectors can't be shared directly
const mouseV = createVector(mouseX, mouseY);

// but you probably only need to share 
// the x and y (and sometimes Z) properties
// unpack the values you need to share
// from the vector
shared.pos = { x: mouseV.x, y: mouseV.y };

// now, shared.pos isn't a p5.Vector, just a simple data object
// shared.pos has the x and y values we need.
ellipse(shared.pos.x, shared.pos.y, 50, 50);

// you can construct a new p5.Vector, if you need to
const length = createVector(shared.pos.x, shared.pos.y).mag();