|
26 | 26 | --heatmap-colors-light-1: #7bc96f;
|
27 | 27 | --heatmap-colors-light-2: #239a3b;
|
28 | 28 | --heatmap-colors-light-3: #196127;
|
| 29 | + --tooltip-bg-light: #fff; |
| 30 | + --tooltip-textstyle-light: #1c1a1b; |
29 | 31 |
|
30 | 32 | --heatmap-bg-dark: #585c59;
|
31 | 33 | --heatmap-colors-dark-0: #c6e48b;
|
32 | 34 | --heatmap-colors-dark-1: #7bc96f;
|
33 | 35 | --heatmap-colors-dark-2: #239a3b;
|
34 | 36 | --heatmap-colors-dark-3: #196127;
|
| 37 | + |
| 38 | + --tooltip-bg-dark: #585c59; |
| 39 | + --tooltip-textstyle-dark: #fff; |
35 | 40 | }
|
36 | 41 | </style>
|
37 | 42 | </head>
|
|
93 | 98 | : getCSSVariableValue('--heatmap-bg-light');
|
94 | 99 | }
|
95 | 100 |
|
| 101 | + function getTooltipBgColor(){ |
| 102 | + const currentTheme = getCurrentTheme(); |
| 103 | + return currentTheme === 'dark' |
| 104 | + ? getCSSVariableValue('--tooltip-bg-dark') |
| 105 | + : getCSSVariableValue('--tooltip-bg-light'); |
| 106 | + } |
| 107 | + |
| 108 | + function getTextStyleColor() { |
| 109 | + const currentTheme = getCurrentTheme(); |
| 110 | + return currentTheme === 'dark' |
| 111 | + ? getCSSVariableValue('--tooltip-textstyle-dark') |
| 112 | + : getCSSVariableValue('--tooltip-textstyle-light'); |
| 113 | + |
| 114 | + } |
| 115 | + |
96 | 116 | function getCSSVariableValue(variableName) {
|
97 | 117 | return getComputedStyle(document.documentElement)
|
98 | 118 | .getPropertyValue(variableName).trim();
|
|
113 | 133 | // Reapply the option with theme-specific colors
|
114 | 134 | option.visualMap.inRange.color = getThemeColors();
|
115 | 135 | option.calendar.itemStyle.color = getThemeBgColor();
|
| 136 | + option.tooltip.backgroundColor = getTooltipBgColor(); |
| 137 | + option.tooltip.textStyle.color = getTextStyleColor(); |
116 | 138 | myChart.setOption(option);
|
117 | 139 | }
|
118 | 140 |
|
|
241 | 263 | tooltip: {
|
242 | 264 | hideDelay: 1000,
|
243 | 265 | enterable: true,
|
| 266 | + textStyle: { |
| 267 | + color: getTextStyleColor(), |
| 268 | + }, |
| 269 | + backgroundColor: getTooltipBgColor(), |
244 | 270 | formatter: function (params) {
|
245 | 271 | const thousandWordsText = {{ default "EN" (.Get "language")}} === "EN" ? 'k words': '千字';
|
246 | 272 | const date = params.data[0];
|
|
0 commit comments