Colours in 0-255 RGB Format

Hi, I’m not sure why Playcanvas works in a way that all colors are based between 0 and 1 but is there a way I can work more easy using RGBA individual values between 0-255 like the rest of the world? :slight_smile:

For example, doing something like this does not seem to work:

var red=pc.math.random(0,40);
    var green=pc.math.random(0,40);
    var blue=pc.math.random(0,40);

    this.tracking_color=new pc.Color(Math.round(red),Math.round(green),Math.round(blue),255);

This post helped: [SOLVED] element.color.set not working - #3 by Jake_Johnson

1 Like