mirror of
https://github.com/KevinMidboe/seasoned.git
synced 2026-03-11 11:55:38 +00:00
24 lines
563 B
JavaScript
24 lines
563 B
JavaScript
export default {
|
|
namespaced: true,
|
|
state: {
|
|
darkmodeSupported: undefined,
|
|
userChoice: undefined
|
|
},
|
|
getters: {
|
|
darkmodeSupported: (state) => {
|
|
return state.darkmodeSupported
|
|
}
|
|
},
|
|
mutations: {
|
|
SET_DARKMODE_SUPPORT: (state, browserSupported) => {
|
|
state.darkmodeSupported = browserSupported
|
|
}
|
|
},
|
|
actions: {
|
|
findAndSetDarkmodeSupported({ commit }) {
|
|
const browserSupported = window.matchMedia('(prefers-color-scheme)').media !== 'not all'
|
|
commit('SET_DARKMODE_SUPPORT', browserSupported)
|
|
}
|
|
}
|
|
}
|