11<script setup lang="ts">
2- import { onMounted , onUnmounted , ref } from " vue" ;
2+ import { onMounted , onUnmounted , reactive , ref } from " vue" ;
33import type { JournalEntries } from " @/model/JournalEntries" ;
44
55const props = defineProps <{
@@ -10,6 +10,10 @@ const emit = defineEmits<{
1010 (e : " load-more" ): void ;
1111}>();
1212
13+ let vm = reactive ({
14+ tableTheme: " " ,
15+ });
16+
1317const scrollComponent = ref <Element | null >(null );
1418
1519type ColumnViewOptions = {
@@ -81,6 +85,12 @@ columnViewOptions.forEach((c, i) => {
8185});
8286
8387onMounted (() => {
88+ const match = window .matchMedia (" (prefers-color-scheme: dark)" );
89+
90+ if (match ) {
91+ vm .tableTheme = " table-dark" ;
92+ }
93+
8494 window .addEventListener (" scroll" , handleScroll );
8595});
8696
@@ -100,7 +110,7 @@ const getRowClass = (row: Array<string>) => `priority-${row[0]}`;
100110<template >
101111 <!-- Log table -->
102112 <div class =" container-fluid" ref =" scrollComponent" >
103- <table class =" table table-striped table-hover table-borderless table-sm" >
113+ <table class =" table table-striped table-hover table-borderless table-sm" :class = " vm.tableTheme " >
104114 <thead >
105115 <th v-for =" c in columnViewOptions.filter((x) => x.visible)" :style =" c.style" >
106116 {{ c.name }}
@@ -191,6 +201,13 @@ const getRowClass = (row: Array<string>) => `priority-${row[0]}`;
191201 color : #666 ;
192202}
193203
204+ main .dark .priority-6 {
205+ color : #bbb ;
206+ }
207+ main .dark .table-striped > tbody > tr .priority-6 :nth-of-type (odd ) > * {
208+ color : #bbb ;
209+ }
210+
194211.priority-6 td :first-child div {
195212 width : 4px ;
196213 height : 24px ;
@@ -200,6 +217,13 @@ const getRowClass = (row: Array<string>) => `priority-${row[0]}`;
200217 color : #aaa ;
201218}
202219
220+ main .dark .priority-7 {
221+ color : #666 ;
222+ }
223+ main .dark .table-striped > tbody > tr .priority-7 :nth-of-type (odd ) > * {
224+ color : #666 ;
225+ }
226+
203227.priority-7 td :first-child div {
204228 width : 4px ;
205229 height : 24px ;
0 commit comments