diff --git a/src/components/fx/hover.js b/src/components/fx/hover.js index a929b9907a0..61796f0eb04 100644 --- a/src/components/fx/hover.js +++ b/src/components/fx/hover.js @@ -713,9 +713,12 @@ function createHoverText(hoverData, opts, gd) { s.attr('data-notex', 1); }); + var commonBgColor = commonLabelOpts.bgcolor || Color.defaultLine; + var commonStroke = commonLabelOpts.bordercolor || Color.contrast(commonBgColor); + lpath.style({ - fill: commonLabelOpts.bgcolor || Color.defaultLine, - stroke: commonLabelOpts.bordercolor || Color.background, + fill: commonBgColor, + stroke: commonStroke }); ltext.text(t0) diff --git a/test/jasmine/tests/hover_label_test.js b/test/jasmine/tests/hover_label_test.js index 87907aea7bd..aa015178067 100644 --- a/test/jasmine/tests/hover_label_test.js +++ b/test/jasmine/tests/hover_label_test.js @@ -1918,7 +1918,7 @@ describe('Test hover label custom styling:', function() { text: [20, 'Arial', 'rgb(255, 0, 0)'] }); assertCommonLabel({ - path: ['rgb(255, 255, 255)', 'rgb(255, 255, 255)'], + path: ['rgb(255, 255, 255)', 'rgb(68, 68, 68)'], text: [13, 'Arial', 'rgb(255, 255, 255)'] }); }) @@ -1930,7 +1930,7 @@ describe('Test hover label custom styling:', function() { text: [20, 'Arial', 'rgb(0, 128, 0)'] }); assertCommonLabel({ - path: ['rgb(255, 255, 255)', 'rgb(255, 255, 255)'], + path: ['rgb(255, 255, 255)', 'rgb(68, 68, 68)'], text: [13, 'Arial', 'rgb(255, 255, 255)'] }); }) @@ -1942,7 +1942,7 @@ describe('Test hover label custom styling:', function() { text: [20, 'Arial', 'rgb(0, 0, 255)'] }); assertCommonLabel({ - path: ['rgb(255, 255, 255)', 'rgb(255, 255, 255)'], + path: ['rgb(255, 255, 255)', 'rgb(68, 68, 68)'], text: [13, 'Arial', 'rgb(255, 255, 255)'] }); @@ -1969,7 +1969,7 @@ describe('Test hover label custom styling:', function() { assertPtLabel(null); assertCommonLabel({ - path: ['rgb(255, 255, 255)', 'rgb(255, 255, 255)'], + path: ['rgb(255, 255, 255)', 'rgb(68, 68, 68)'], text: [13, 'Arial', 'rgb(255, 255, 255)'] });