> For the complete documentation index, see [llms.txt](https://ubtechedu.gitbook.io/chinese/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ubtechedu.gitbook.io/chinese/standard/sensor/color/readcolor.md).

# readColor(id,color)

颜色传感器识别色块颜色

### 参数

| 参数名   | 类型            | 描述                                                                     |
| ----- | ------------- | ---------------------------------------------------------------------- |
| id    | unsigned char | 要控制的ID号，范围0\~10                                                        |
| color | String        | 填入要检测的颜色，目前支持Red,Green,Blue,Yellow,Cyan,Purple,Orange,Black,White,Gray |

### 返回

| 参数名    | 类型      | 描述                           |
| ------ | ------- | ---------------------------- |
| number | boolean | 返回布尔值，若设置的颜色和检测的颜色相同则返回真，否则假 |

### 例子
