diff --git a/src/sectorBuilder.ts b/src/sectorBuilder.ts index 5a37e9f..b903943 100644 --- a/src/sectorBuilder.ts +++ b/src/sectorBuilder.ts @@ -55,7 +55,10 @@ export class SectorBuilder { // 颜色优先级:sector > layer pattern > background const fillColor = this.colorResolver.resolveSectorColor(layerColorMap, sectorConfig, i); - const textColor = getTextColorForBackground(fillColor); + const layerColor = layer.colorRef ? this.colorResolver.resolveColor(layer.colorRef) : undefined; + const sectorColor = sectorConfig?.colorRef + ? this.colorResolver.resolveColor(sectorConfig.colorRef) + : undefined; const innerFill = (sectorConfig?.innerFill ?? layer.innerFill ?? 0) === 1; const innerFillPath = innerFill ? annularSectorInsetPath( @@ -70,6 +73,9 @@ export class SectorBuilder { innerFillPath && innerFillPath.length > 0 ? innerFillPath : undefined; const hasInnerFillPath = Boolean(normalizedInnerFillPath); const baseFillColor = hasInnerFillPath ? '#ffffff' : fillColor; + const innerFillColor = hasInnerFillPath ? sectorColor ?? layerColor ?? fillColor : undefined; + const textBaseColor = hasInnerFillPath ? innerFillColor ?? fillColor : fillColor; + const textColor = getTextColorForBackground(textBaseColor); const sectorKey = `L${layerIndex}-P${i}`; const textPathId = `text-path-${sectorKey}`; @@ -123,7 +129,7 @@ export class SectorBuilder { label: isMultiText ? '' : rawContent, path: annularSectorPath(layer.rInner, layer.rOuter, aStart, aEnd), innerFillPath: normalizedInnerFillPath, - innerFillColor: hasInnerFillPath ? fillColor : undefined, + innerFillColor, textPath, textPathId, isVertical,