Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/394.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
这些JavaScript颜色代码是什么意思?_Javascript_Colors - Fatal编程技术网

这些JavaScript颜色代码是什么意思?

这些JavaScript颜色代码是什么意思?,javascript,colors,Javascript,Colors,在学习如何编写代码时,我在JavaScript中发现了以下代码块: // Color variables: red = [0, 100, 63]; orange = [40, 100, 60]; green = [75, 100, 40]; blue = [196, 77, 55]; purple = [280, 50, 60]; // Letters in the message will cycle through these colors: letterColors = [red, or

在学习如何编写代码时,我在JavaScript中发现了以下代码块:

// Color variables:
red = [0, 100, 63];
orange = [40, 100, 60];
green = [75, 100, 40];
blue = [196, 77, 55];
purple = [280, 50, 60];

// Letters in the message will cycle through these colors:
letterColors = [red, orange, green, blue, purple];

message = 'Multiple colors!';

drawName(message, letterColors);
bounceBubbles();
这是什么颜色代码?我以为它是RGB,但它的值会上升到255,因此颜色“紫色”是不可能的


有什么想法吗?

RGB颜色值由
RGB(红、绿、蓝)
指定

每个参数(红色、绿色、蓝色)将颜色的强度定义为0到255之间的整数


您将在此处获得所有不同颜色的RGB值:

什么是
drawName
?在SO上发布欢迎信息!有时会使用不同的缩放,但我觉得这是一个bug。注意,它只是一个数组,理论上任何东西都可能存在,程序在语法上都可以。在codecademy练习中,“drawName”用气泡将消息直接绘制在函数的括号内。它写的正是您所指的:“在这个项目中,我们使用HSL(色调、饱和度、亮度)。您可以阅读有关HSL和其他颜色模型的信息。“第一个值以度为单位,实际上可以是任何数字,因为它将被调制为360。也可以定义为%。但无论如何,OP中的值是针对HSL的,而不是RGB。