mirror of
https://github.com/mmjee/Piped-Material.git
synced 2024-12-06 19:26:36 +01:00
Add back old hack because it's still needed
This commit is contained in:
+22
-1
@@ -1,6 +1,9 @@
|
||||
import Vue from 'vue'
|
||||
import Vuetify from 'vuetify/lib/framework'
|
||||
|
||||
import { isString } from 'lodash-es'
|
||||
import { COLOR_SCHEME_STATES } from '@/store/prefs-store'
|
||||
|
||||
Vue.use(Vuetify)
|
||||
|
||||
export default new Vuetify({
|
||||
@@ -9,7 +12,25 @@ export default new Vuetify({
|
||||
},
|
||||
theme: {
|
||||
// There's apparently a race condition that causes components being rendered shortly before dark mode initialization unable to change to dark mode
|
||||
dark: false,
|
||||
dark: (() => {
|
||||
// Partly duplicated in App.vue
|
||||
try {
|
||||
const LSValue = window.localStorage.getItem('COLOR_SCHEME')
|
||||
if (isString(LSValue) && LSValue.length !== 0) {
|
||||
const state = JSON.parse(LSValue)
|
||||
switch (state) {
|
||||
case COLOR_SCHEME_STATES.SYSTEM:
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
case COLOR_SCHEME_STATES.DARK:
|
||||
return true
|
||||
case COLOR_SCHEME_STATES.LIGHT:
|
||||
return false
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
})(),
|
||||
themes: {
|
||||
light: {
|
||||
primary: '#455A64',
|
||||
|
||||
Reference in New Issue
Block a user