-
-
Notifications
You must be signed in to change notification settings - Fork 906
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
46 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { watchEffect } from "vue" | ||
import { useSettingsStore } from "@/store/modules/settings" | ||
|
||
const GREY_MODE = "grey-mode" | ||
const COLOR_WEAKNESS = "color-weakness" | ||
const classList = document.documentElement.classList | ||
|
||
/** 初始化 */ | ||
const initGreyAndColorWeakness = () => { | ||
const settingsStore = useSettingsStore() | ||
watchEffect(() => { | ||
settingsStore.showGreyMode ? classList.add(GREY_MODE) : classList.remove(GREY_MODE) | ||
settingsStore.showColorWeakness ? classList.add(COLOR_WEAKNESS) : classList.remove(COLOR_WEAKNESS) | ||
}) | ||
} | ||
|
||
/** 灰色模式和色弱模式 hook */ | ||
export function useGreyAndColorWeakness() { | ||
return { initGreyAndColorWeakness } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters