diff --git a/src/component/legend/LegendView.ts b/src/component/legend/LegendView.ts index 5b4a342599..9af5ffb664 100644 --- a/src/component/legend/LegendView.ts +++ b/src/component/legend/LegendView.ts @@ -413,16 +413,18 @@ class LegendView extends ComponentView { content = formatter(name); } - const inactiveColor = legendItemModel.get('inactiveColor'); + const textColor = isSelected + ? textStyleModel.getTextColor() : legendItemModel.get('inactiveColor'); + itemGroup.add(new graphic.Text({ style: createTextStyle(textStyleModel, { text: content, x: textX, y: itemHeight / 2, - fill: isSelected ? textStyleModel.getTextColor() : inactiveColor, + fill: textColor, align: textAlign, verticalAlign: 'middle' - }) + }, {inheritColor: textColor}) })); // Add a invisible rect to increase the area of mouse hover