我有一段使用 RGB 颜色选择的代码,我想知道如何让 JavaScript 使用 RGB 方法生成随机颜色并在整个代码中记住。
编辑:我尝试过这样做:
var RGBColor1 = (Math.round, Math.random, 255)
var RGBColor2 = (Math.round, Math.random, 255)
var RGBColor3 = (Math.round, Math.random, 255)
但它不起作用。请帮忙!
编辑2:代码使用了这个:
g.fillStyle="rgba(R,G,B,0.2)";
g.strokeStyle="rgba(R,G,B,0.3)";
E();
这些字母代表RGB颜色。
编辑3:这个问题的重复使用十六进制值,而不是RGB值。
"rgb(n1, n2, n3)"
),并将其赋值给一个变量。你卡在哪里了? - David Thomas