generated from Seekra/repository-template
Compare commits
2
Commits
main
...
a10890d615
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a10890d615
|
||
|
|
630a8268e3
|
+22
-14
@@ -24,15 +24,28 @@ import { ref, provide, watch } from 'vue';
|
|||||||
const { getColorScheme, updateColorScheme } = useColorScheme();
|
const { getColorScheme, updateColorScheme } = useColorScheme();
|
||||||
const colorScheme = ref(getColorScheme());
|
const colorScheme = ref(getColorScheme());
|
||||||
provide('colorScheme', colorScheme);
|
provide('colorScheme', colorScheme);
|
||||||
watch(colorScheme, val => updateColorScheme(val))
|
watch(colorScheme, (newValue) => {
|
||||||
|
updateColorScheme(newValue);
|
||||||
|
document.body.style.setProperty(colorScheme, {
|
||||||
|
auto: 'normal',
|
||||||
|
dark: 'dark',
|
||||||
|
light: 'light'
|
||||||
|
});
|
||||||
|
if (newValue === 'dark') {
|
||||||
|
document.body.classList.add('dark');
|
||||||
|
} else {
|
||||||
|
document.body.classList.remove('dark');
|
||||||
|
}
|
||||||
|
if (newValue === 'auto') {
|
||||||
|
document.body.classList.add('color-scheme-auto');
|
||||||
|
} else {
|
||||||
|
document.body.classList.remove('color-scheme-auto');
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div id="app-wrapper">
|
||||||
:style="{ colorScheme: colorScheme === 'auto' ? 'normal' : (colorScheme === 'dark' ? 'dark' : 'light')}"
|
|
||||||
:class="{ dark: colorScheme === 'dark', 'color-scheme-auto': colorScheme === 'auto' }"
|
|
||||||
id="app-wrapper"
|
|
||||||
>
|
|
||||||
<Navbar />
|
<Navbar />
|
||||||
|
|
||||||
<router-view class="main-content" />
|
<router-view class="main-content" />
|
||||||
@@ -46,6 +59,9 @@ watch(colorScheme, val => updateColorScheme(val))
|
|||||||
--main-content-padding-x: 30px;
|
--main-content-padding-x: 30px;
|
||||||
--main-content-padding-y: 40px;
|
--main-content-padding-y: 40px;
|
||||||
--main-content-padding: var(--main-content-padding-y) var(--main-content-padding-x);
|
--main-content-padding: var(--main-content-padding-y) var(--main-content-padding-x);
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-content {
|
.main-content {
|
||||||
@@ -57,12 +73,4 @@ watch(colorScheme, val => updateColorScheme(val))
|
|||||||
--main-content-padding-x: 15px;
|
--main-content-padding-x: 15px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#app-wrapper {
|
|
||||||
min-height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
background-color: var(--light-bg);
|
|
||||||
color: var(--dark);
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
@@ -15,6 +15,8 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
background-color: var(--light-bg);
|
||||||
|
color: var(--dark);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#app-wrapper {
|
body {
|
||||||
--primary-color-l-8: oklch(0.897 0.202 260);
|
--primary-color-l-8: oklch(0.897 0.202 260);
|
||||||
--primary-color-l-7: oklch(0.847 0.202 260);
|
--primary-color-l-7: oklch(0.847 0.202 260);
|
||||||
--primary-color-l-6: oklch(0.797 0.202 260);
|
--primary-color-l-6: oklch(0.797 0.202 260);
|
||||||
@@ -87,7 +87,7 @@ limitations under the License.
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
#app-wrapper.color-scheme-auto {
|
body.color-scheme-auto {
|
||||||
--dark-l-8: var(--white-d-8);
|
--dark-l-8: var(--white-d-8);
|
||||||
--dark-l-7: var(--white-d-7);
|
--dark-l-7: var(--white-d-7);
|
||||||
--dark-l-6: var(--white-d-6);
|
--dark-l-6: var(--white-d-6);
|
||||||
@@ -121,7 +121,7 @@ limitations under the License.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#app-wrapper.dark {
|
body.dark {
|
||||||
--dark-l-8: var(--white-d-8);
|
--dark-l-8: var(--white-d-8);
|
||||||
--dark-l-7: var(--white-d-7);
|
--dark-l-7: var(--white-d-7);
|
||||||
--dark-l-6: var(--white-d-6);
|
--dark-l-6: var(--white-d-6);
|
||||||
|
|||||||
Reference in New Issue
Block a user