Home > PCB_Layer > setLayerColorConfiguration
PCB_Layer.setLayerColorConfiguration() method
此 API 当前处于 BETA 预览状态,希望得到开发者的反馈。它的任何功能都可能在接下来的开发进程中被修改,请不要将它用于任何正式环境。
设置层颜色配置
签名
typescript
function setLayerColorConfiguration(
colorConfiguration: EPCB_LayerColorConfiguration,
): Promise<boolean>;1
2
3
2
3
参数名
参数 | 类型 | 描述 |
|---|---|---|
colorConfiguration | 颜色配置 |
返回值
Promise<boolean>
操作是否成功
示例
javascript
// 1. 记录切换前顶层的颜色
const before = (await eda.pcb_Layer.getAllLayers()).find(l => l.id === 1);
// 2. 切换为 Altium Designer 配色(ALTIUM_DESIGNER=2)
const setResult = await eda.pcb_Layer.setLayerColorConfiguration(2);
// 3. 查看切换后顶层的颜色
const after = (await eda.pcb_Layer.getAllLayers()).find(l => l.id === 1);
// 4. 恢复嘉立创 EDA 默认配色(EASYEDA=1)
const restoreResult = await eda.pcb_Layer.setLayerColorConfiguration(1);
console.log('setResult:', setResult);
console.log('topColorBefore:', before?.color, '→ topColorAfter:', after?.color);
console.log('restoreResult:', restoreResult);1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15