@@ -5,8 +5,9 @@ import { readonly, ref, shallowRef, triggerRef, watchEffect } from 'vue'
55import pAll from 'p-all'
66import { type UpdateManifest , installUpdate } from '@tauri-apps/api/updater'
77import { relaunch } from '@tauri-apps/api/process'
8+ import { computedEager } from '@vueuse/core'
89import { type Thread , getNotifications , markNotificationAsRead , unsubscribeNotification } from '../api/notifications'
9- import { InvokeCommand , Page , notificationApiMutex } from '../constants'
10+ import { ColorPreference , InvokeCommand , Page , notificationApiMutex , prefersDark } from '../constants'
1011import { AppStorage } from '../storage'
1112import type { AppStorageContext , NotificationList , Option , PageState } from '../types'
1213import { filterNewThreads , isRepository , isThread , toNotificationList } from '../utils/notification'
@@ -200,6 +201,21 @@ export const useStore = defineStore('store', () => {
200201 }
201202 }
202203
204+ const theme = computedEager ( ( ) => {
205+ const preference = AppStorage . get ( 'colorPreference' )
206+
207+ let theme : ColorPreference . Dark | ColorPreference . Light
208+
209+ if ( preference === ColorPreference . Dark )
210+ theme = ColorPreference . Dark
211+ else if ( preference === ColorPreference . Light )
212+ theme = ColorPreference . Light
213+ else
214+ theme = prefersDark . value ? ColorPreference . Dark : ColorPreference . Light
215+
216+ return theme
217+ } )
218+
203219 return {
204220 newRelease,
205221 notifications,
@@ -211,6 +227,7 @@ export const useStore = defineStore('store', () => {
211227 currentPageState,
212228 checkedItems,
213229 installingUpate,
230+ theme,
214231 updateAndRestart,
215232 unsubscribeCheckedNotifications,
216233 removeNotificationById,
0 commit comments