vendredi 4 février 2022

Why I can't use a random colour generated with rgba? [duplicate]

When I use this function to generate random colours the lint said:

Converts a string to an integer.

@param string — A string to convert into a number.

@param radix A value between 2 and 36 that specifies the base of the number in string. If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. All other strings are considered decimal.

function colorGenerate() {
  const red = parseInt(Math.random() * 256);
  const green = parseInt(Math.random() * 256);
  const blue = parseInt(Math.random() * 256);
  return `rgb(${red}, ${green}, ${blue})`;
}



Aucun commentaire:

Enregistrer un commentaire