@@ -23,7 +23,11 @@ export default {
2323<script lang="ts" setup>
2424import { onMounted , ref } from ' vue' ;
2525import { injectStorage } from ' ../storage/inject-storage' ;
26- import { StorageDeserializeParam } from ' ../storage/storage-params' ;
26+ import {
27+ DARK_MODE_DEFAULT ,
28+ StorageDeserializeParam ,
29+ StorageParams ,
30+ } from ' ../storage/storage-params' ;
2731import { TimeInterval } from ' ../entity/time-interval' ;
2832import { todayLocalDate } from ' ../utils/date' ;
2933import { useI18n } from ' vue-i18n' ;
@@ -43,6 +47,7 @@ const storage = injectStorage();
4347const chart = ref <any >();
4448const minValue = ref <number >();
4549const todayIntervals = ref <TimeInterval []>();
50+ const darkMode = ref ();
4651
4752type DataForChart = {
4853 domain: string ;
@@ -56,6 +61,7 @@ onMounted(async () => {
5661 )) as TimeInterval [];
5762
5863 todayIntervals .value = timeIntervalList ?.filter (x => x .day == todayLocalDate ());
64+ darkMode .value = await storage .getValue (StorageParams .DARK_MODE , DARK_MODE_DEFAULT );
5965 renderChart ();
6066});
6167
@@ -157,12 +163,16 @@ function drawIntervalChart(data: DataForChart[]) {
157163 svg
158164 .append (' g' )
159165 .attr (' class' , ' grid' )
160- .style (' color' , ' #e5e5e5' )
166+ .style (' color' , darkMode . value ? ' #797979 ' : ' #e5e5e5' )
161167 .attr (' transform' , ` translate(0, ${height }) ` )
162168 .call (xAxis .tickSize (- height ));
163169
164- svg .append (' g' ).attr (' class' , ' grid' ).style (' color' , ' #e5e5e5' ).call (yAxis .tickSize (- width ));
165- svg .selectAll (' text' ).style (' fill' , ' black' );
170+ svg
171+ .append (' g' )
172+ .attr (' class' , ' grid' )
173+ .style (' color' , darkMode .value ? ' #797979' : ' #e5e5e5' )
174+ .call (yAxis .tickSize (- width ));
175+ svg .selectAll (' text' ).style (' fill' , ' #797979' );
166176
167177 // draw the bars, offset y and bar height based on data
168178 svg
0 commit comments