Home > PCB_Layer > setLayerColorConfiguration
PCB_Layer.setLayerColorConfiguration() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Set the layer color configuration
Signature
typescript
function setLayerColorConfiguration(
colorConfiguration: EPCB_LayerColorConfiguration,
): Promise<boolean>;1
2
3
2
3
Parameters
Parameter | Type | Description |
|---|---|---|
colorConfiguration | Color configuration |
Returns
Promise<boolean>
Whether the operation is successful
Example
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