mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-27 21:15:57 +02:00
15 lines
431 B
JavaScript
15 lines
431 B
JavaScript
// Toy
|
|
const MAX_RGB_COMPONENT_VALUE = 256 / 2; // Limit the values to half the maximum.
|
|
const MIN_COLOR_VALUE = 127;
|
|
function newColor() {
|
|
color = {
|
|
red: randomPastelRGBComponent(),
|
|
green: randomPastelRGBComponent(),
|
|
blue: randomPastelRGBComponent()
|
|
};
|
|
return color;
|
|
}
|
|
// Helper functions.
|
|
function randomPastelRGBComponent() {
|
|
return Math.floor(Math.random() * MAX_RGB_COMPONENT_VALUE) + MIN_COLOR_VALUE;
|
|
}
|