fromRandom
fun fromRandom(options: Color.Companion.FromRandomOptions? = definedExternally, result: Color? = definedExternally): Color(source)
Creates a random color using the provided options. For reproducible random colors, you should call Math.setRandomNumberSeed once at the beginning of your application.
//Create a completely random color
const color = Color.fromRandom();
//Create a random shade of yellow.
const color1 = Color.fromRandom({
red : 1.0,
green : 1.0,
alpha : 1.0
});
//Create a random bright color.
const color2 = Color.fromRandom({
minimumRed : 0.75,
minimumGreen : 0.75,
minimumBlue : 0.75,
alpha : 1.0
});
Content copied to clipboard
Return
The modified result parameter or a new instance if result was undefined.
Parameters
result
The object to store the result in, if undefined a new instance will be created.