feat: 新增 global-dark-text-color 与 global-dark-background-color 主题变量

This commit is contained in:
就眠儀式 2022-04-03 15:55:41 +08:00
parent 10d404239f
commit 08c2058707
2 changed files with 9 additions and 5 deletions

View File

@ -19,7 +19,7 @@ const props = withDefaults(defineProps<LayTimelineProps>(), {
const timeLineClass = computed(() => [ const timeLineClass = computed(() => [
"layui-timeline", "layui-timeline",
props.direction === "horizontal" ? "layui-timeline-horizontal" : "", props.direction === "horizontal" ? "layui-timeline-horizontal" : "",
]) ]);
</script> </script>
<template> <template>

View File

@ -46,8 +46,12 @@ const changeTheme = (theme: string) => {
brightness: 100, brightness: 100,
contrast: 90, contrast: 90,
sepia: 0, sepia: 0,
darkSchemeTextColor: getComputedStyle(document.documentElement).getPropertyValue("--global-dark-text-color"), darkSchemeTextColor: getComputedStyle(
darkSchemeBackgroundColor: getComputedStyle(document.documentElement).getPropertyValue("--global-dark-background-color") document.documentElement
).getPropertyValue("--global-dark-text-color"),
darkSchemeBackgroundColor: getComputedStyle(
document.documentElement
).getPropertyValue("--global-dark-background-color"),
}, },
{ {
invert: [], invert: [],
@ -60,10 +64,10 @@ const changeTheme = (theme: string) => {
disableStyleSheetsProxy: false, disableStyleSheetsProxy: false,
} }
); );
localStorage.setItem('layui-vue-theme-dark','true') localStorage.setItem("layui-vue-theme-dark", "true");
} else { } else {
disableDarkMode(); disableDarkMode();
localStorage.setItem('layui-vue-theme-dark','false') localStorage.setItem("layui-vue-theme-dark", "false");
} }
}; };