mirror of
https://github.com/fmhy/edit.git
synced 2025-11-27 16:31:09 +11:00
Update ColorPicker.vue
This commit is contained in:
parent
ba9fe8fa3f
commit
b607799836
1 changed files with 13 additions and 7 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { colors } from '@fmhy/colors'
|
import { colors } from '@fmhy/colors'
|
||||||
import { useStorage, useStyleTag } from '@vueuse/core'
|
import { useStorage, useStyleTag } from '@vueuse/core'
|
||||||
import { watch, onMounted } from 'vue'
|
import { watch, onMounted, nextTick } from 'vue'
|
||||||
import amoledswitch from './amoledswitch.vue'
|
import amoledswitch from './amoledswitch.vue'
|
||||||
|
|
||||||
const colorScales = [
|
const colorScales = [
|
||||||
|
|
@ -91,13 +91,19 @@ const updateThemeColor = (colorName: ColorNames, amoledEnabled: boolean) => {
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(async () => {
|
||||||
if (isAmoledMode.value) {
|
// Wait for next tick to ensure DOM is ready
|
||||||
document.documentElement.classList.add('theme-amoled')
|
await nextTick()
|
||||||
}
|
|
||||||
|
|
||||||
// Re-apply the theme to ensure everything is initialized
|
// Small delay to ensure VitePress dark mode is initialized
|
||||||
updateThemeColor(selectedColor.value, isAmoledMode.value)
|
setTimeout(() => {
|
||||||
|
if (isAmoledMode.value) {
|
||||||
|
document.documentElement.classList.add('theme-amoled')
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force re-apply the theme
|
||||||
|
updateThemeColor(selectedColor.value, isAmoledMode.value)
|
||||||
|
}, 100)
|
||||||
})
|
})
|
||||||
|
|
||||||
watch([selectedColor, isAmoledMode], ([color, amoled]) => {
|
watch([selectedColor, isAmoledMode], ([color, amoled]) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue