Jump to content

How to change background color


Recommended Posts

Thanks for quick response. Is there an other way then to access canvas context in phaser3? For example I used  Game.resize() method to resize the canvas, but dont find how to change other parameters (like background color I mentionned above). Where to search in Phaser API / any examples ?

Link to comment
Share on other sites

  • captainHook changed the title to How to change background color
  • 3 months later...
  • 10 months later...
  • 1 year later...

This is link of git for change background:

https://github.com/photonstorm/phaser-examples/blob/master/examples/display/game background color.


function create() {

    //  You can set the background color of your game in the following ways:

    game.stage.backgroundColor = "#4488AA";
    // game.stage.backgroundColor = 0x4488aa;
    // game.stage.backgroundColor = 'rgb(68, 136, 170)';
    // game.stage.backgroundColor = 'rgba(68, 136, 170, 0.5)';

    game.add.image(game.world.centerX, game.world.centerY, 'hotdog').anchor.set(0.5);

    //  Click for a new background color
    game.input.onDown.add(changeColor, this);



Edited by Eivan92
No show coding
Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...