Here an alternative solution with Geometry Nodes for the upcoming Blender 3.0 (alpha) and Cycles only. No particles involed and it doesn't work in Eevee :(
(Experimental! At the time of writing this answer Blender 3.0 is still an Alpha version and in development. Don't try this at home! Do not use it for production. It can mess up your blend file. Use at your own risk.)
The magic trick is to create the instance spheres at the vertex positions of the cube and use the vertex color to color them.
The Point Instance node is already available in Blender 2.93, but for the color data you need the new Attribute Transfer node of Blender 3.0.
Step 1: Subdivide your object (cube) if needed to create some vertices. For objects like a cone or torus add & apply the Remesh modifier to create more vertices. Try operation type
Then switch to Vertex Paint mode and Solid view, choose Vertex color display in the Viewport Shading options so you can see what you paint. Stencil brush works in Vertex Paint and you can use images if you like.
Step 2: After this is done, create the sphere object. Keep it low-poly because it will be cloned many times. Then add a Geometry Node modifier to your object (cube, cone, torus, ...). Open the Geometry Nodes editor and create the node setup.
Col is the vertex color attribute. Geo Color is a custom attribute that is used to transfer the color. You can choose any name you want.
Step 3: Last but not least, create the material for the instance sphere. Here you use the Attribute node with the Geo Color attribute to get the color data.
Make sure you set viewport shading (Z) to Rendered and you use Cycles. The point instance color doesn't work in Material Preview mode (it's all black).