Random Color

Demonstrates how to generate random colors with a minimum brightness threshold using the Phaser Color object.

Random Color, running
800 × 600
GitHub
class Example extends Phaser.Scene
{
    constructor ()
    {
        super();
    }

    create ()
    {
        const color = new Phaser.Display.Color();
        for (let i = 0; i < 100; i++)
        {
            color.random(50);
            this.add.rectangle(400, i * 6, 800, 6, color.color);
        }
    }
}

const config = {
    scale: { mode: Phaser.Scale.FIT },
    type: Phaser.AUTO,
    parent: 'game-container',
    width: 800,
    height: 600,
    scene: Example
};

const game = new Phaser.Game(config);

More in Color9 examples