This can be easily achieved for
windowed mode (e.g. if the user resizes or maximises the window) by editing the following line of your project's
index.html file (right-click > Open With). Do make a copy of the file beforehand, as a backup in case something goes wrong!
HTML:
<body style="background-color: black">
To replace the solid black colour with an image, you can replace the above line with something like:
HTML:
<body style="background-image: url('./img/faces/Actor1.png')">
I've chosen a face image just as an example, edit the file path as needed~
If you want it to apply in
full-screen (either stretched or bordered mode, via F3) then that'll be more tricky. By default full-screen (F4) invokes the native
requestFullScreen method, which seems to make the game canvas cover the screen (blotting out any page background). I believe you'd need a plugin that changes the rendering or full-screen behaviour somehow. I did a quick search online and through the game code, but didn't find anything promising in that regard.
In case you're interested, you can find more technical details on page backgrounds HTML/CSS here:
The background shorthand CSS property sets all background style properties at once, such as color, image, origin and size, or repeat method.
developer.mozilla.org