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(() => [
"layui-timeline",
props.direction === "horizontal" ? "layui-timeline-horizontal" : "",
])
]);
</script>
<template>

View File

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