How to change the background color of Matter js render at runtime

Posted on February 18, 2023

If you need to change the background color of the render in a Matter.js project at runtime (after you've already initialized), here the tiny solution:

// you have a render
var render = Render.create({...})

// ...
// here the color change
render.options.background = 'red'