API/colors/zh
Colors(颜色) API
此“API”提供了一个全局列表,让你能够以名称调用颜色,而无需以对应编号调用。此表可以双向查询。例如,colors.blue的值为11,而colors[11]的值为字符串blue。 下表为所定义的颜色:
- 白色 (
white),编号:0 - 橙色 (orange),编号:1 - 品红色 (magenta),编号:2 - 淡蓝色 (lightblue),编号:3 - 黄色 (yellow),编号:4 - 黄绿色 (lime),编号:5 - 粉红色 (pink),编号:6 - 灰色 (gray),编号:7 - 淡灰色 (silver),编号:8 - 青色 (cyan),编号:9 - 紫色 (purple),编号:10 - 蓝色 (blue),编号:11 - 棕色 (brown),编号:12 - 绿色 (green),编号:13 - 红色 (red),编号:14 - 黑色 (black),编号:15
请注意编号从0而不是1开始。
此表在你需要设置或读取集束红石线缆中信号的时候很有用,例如:
local component = require("component") local colors = require("colors") local rs = component.redstone rs.setBundledOutput(sides.back, colors.green, rs.getBundledInput(sides.front, colors.blue))会将后方的信号强度输出到前方。
目录
| < 100% 15% 15% > | ||
| API | OpenOS | buffer - colors - component - computer - event - filesystem - uuid - internet - keyboard - note - process - rc - robot - serialization - shell - sides - term - text - thread - transforms - unicode |
| ::: | Lua 库 | coroutine - package - io - os |