繁体   English   中英

将十六进制代码转换为JavaScript

[英]HEX Code into JavaScript

如何将HEX代码放入可汗学院的JavaScript中? 我想使它成为填充色,但是找不到正确的命令。 我尝试了很多人也尝试过的方法,但似乎在可汗学院都没有用。 请帮忙。

您将必须从十六进制转换为十进制。 使用KA上的颜色功能,您将获得三个十进制数字,并用逗号分隔代表十六进制代码。 例如:

0xFFFFFF将是: color(255,255,255);

KA中的颜色命令:

background(r, g, b)
Set the background color

fill(r, g, b)
Set the fill color for shapes

noFill()
Turn off fill for shapes

stroke(r, g, b)
Set the outline color for shapes

strokeWeight(thickness)
Change the thickness of lines and outlines

noStroke()
Turn off outlines for shapes

color(r, g, b)
Store a color in a variable

blendColor(c1, c2, MODE)
Blend two colors together

lerpColor(c1, c2, amount)
Find color between 2 colors```

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM