diff --git a/src/component/legend/LegendView.ts b/src/component/legend/LegendView.ts index 5b4a342599273d2d5293a161ac68956dfca247bb..9af5ffb664737f338d7601a0c09b79c101a739ba 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 diff --git a/test/legend-style.html b/test/legend-style.html index d822235aaff1129ebb6b64b5d6600b6b9bb723bf..803dac2ee05db235d2b745229e879aa57f18c977 100644 --- a/test/legend-style.html +++ b/test/legend-style.html @@ -36,6 +36,7 @@ under the License.
+
+ + +