Skip to content

Commit 7b4468b

Browse files
author
reco_luan
committed
Merge branch 'develop' of github.com:recoluan/vuepress-theme-reco into develop
2 parents ab94806 + 1e0c6e5 commit 7b4468b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/vuepress-theme-reco/components/Mode/applyMode.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ import modeOptions from './modeOptions'
33
function render (mode) {
44
const rootElement = document.querySelector(':root')
55
const options = modeOptions[mode]
6+
const opposite = mode === 'dark' ? 'light' : 'dark'
67

78
for (const k in options) {
89
rootElement.style.setProperty(k, options[k])
910
}
11+
12+
rootElement.classList.remove(opposite)
13+
rootElement.classList.add(mode)
1014
}
1115

1216
/**

0 commit comments

Comments
 (0)