Add support for light Theme

This commit is contained in:
Matthias 2023-12-02 14:00:57 +01:00
parent 635d70fe56
commit 6239d30fbc
2 changed files with 6 additions and 4 deletions

View File

@ -133,7 +133,7 @@ const diffCols = computed(() => {
return getDiffColumnsFromPlotConfig(props.plotConfig); return getDiffColumnsFromPlotConfig(props.plotConfig);
}); });
usePercentageTool(candleChart); usePercentageTool(candleChart, props.theme);
function updateChart(initial = false) { function updateChart(initial = false) {
if (!hasData.value) { if (!hasData.value) {

View File

@ -5,9 +5,11 @@ import { GraphicComponent } from 'echarts/components';
use([GraphicComponent]); use([GraphicComponent]);
export function usePercentageTool(chartRef: Ref) { export function usePercentageTool(chartRef, theme: string) {
const inputListener = useInputListener(); const inputListener = useInputListener();
const color = theme === 'dark' ? 'white' : 'black';
const mousePos = ref({ x: 0, y: 0 }); const mousePos = ref({ x: 0, y: 0 });
const startPos = ref({ x: 0, y: 0 }); const startPos = ref({ x: 0, y: 0 });
const drawLimitPerSecond = 144; const drawLimitPerSecond = 144;
@ -37,7 +39,7 @@ export function usePercentageTool(chartRef: Ref) {
y2: mousePos.value.y, y2: mousePos.value.y,
}, },
style: { style: {
stroke: 'white', stroke: color,
}, },
}, },
{ type: 'text', z: 5 }, { type: 'text', z: 5 },
@ -74,7 +76,7 @@ export function usePercentageTool(chartRef: Ref) {
y: y - 20, y: y - 20,
text: (startPrice < endPrice ? pct : '-' + pct) + '%', text: (startPrice < endPrice ? pct : '-' + pct) + '%',
font: '16px sans-serif', font: '16px sans-serif',
fill: 'white', fill: color,
}, },
}, },
], ],