White numbers on graph in dark mode

This commit is contained in:
Gunnar Skjold
2024-04-06 11:44:41 +02:00
parent 29c8011cda
commit bd11dee1e5
8 changed files with 14 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@@ -83,7 +83,7 @@
width="{barWidth - 4}"
dominant-baseline="middle"
text-anchor="{barWidth < vertSwitch || point.labelAngle ? 'left' : 'middle'}"
fill="{yScale(point.value) > yScale(0)-labelOffset ? point.color : 'white'}"
fill="{yScale(point.value) > yScale(0)-labelOffset && !config.dark ? point.color : 'white'}"
transform="translate({xScale(i) + barWidth/2} {yScale(point.value) > yScale(0) - labelOffset ? yScale(point.value) - labelOffset : yScale(point.value) + 10}) rotate({point.labelAngle ? point.labelAngle : barWidth < vertSwitch ? 90 : 0})"
>{point.label}</text>
@@ -107,7 +107,7 @@
width="{barWidth - 4}"
dominant-baseline="middle"
text-anchor="{'middle'}"
fill="{yScale(-point.value2) < yScale(0) + 15 ? point.color2 ? point.color2 : point.color : 'white'}"
fill="{yScale(-point.value2) < yScale(0) + 15 && !config.dark ? point.color2 ? point.color2 : point.color : 'white'}"
transform="translate({xScale(i) + (barWidth/2)} {yScale(-point.value2) < yScale(0) + 15 ? yScale(-point.value2) + 15 : yScale(-point.value2) - 14}) rotate({barWidth < vertSwitch ? 90 : 0})"
>{point.label2}</text>
{#if point.title2}

View File

@@ -97,6 +97,7 @@
config = {
title: title,
dark: document.documentElement.classList.contains('dark'),
height: 226,
width: 1520,
padding: { top: 20, right: 15, bottom: 20, left: 35 },

View File

@@ -98,6 +98,7 @@
config = {
title: title.replace('{0}', lm.getDate().toFixed(0)) + " (kWh)",
dark: document.documentElement.classList.contains('dark'),
height: 226,
width: 1520,
padding: { top: 20, right: 15, bottom: 20, left: 35 },

View File

@@ -79,6 +79,7 @@
config = {
title: title,
dark: document.documentElement.classList.contains('dark'),
padding: { top: 20, right: 15, bottom: 20, left: 35 },
y: {
min: -maxExport,

View File

@@ -115,6 +115,7 @@
config = {
title: title + " (" + currency + ")",
dark: document.documentElement.classList.contains('dark'),
padding: { top: 20, right: 15, bottom: 20, left: 35 },
y: {
min: min,

View File

@@ -80,6 +80,7 @@
config = {
title: title,
dark: document.documentElement.classList.contains('dark'),
padding: { top: 20, right: 35, bottom: 20, left: 35 },
y: {
min: min,

View File

@@ -49,6 +49,7 @@
config = {
title: title + " (°C)",
dark: document.documentElement.classList.contains('dark'),
height: 226,
width: 1520,
padding: { top: 20, right: 15, bottom: 20, left: 35 },