Debounce color picker

This commit is contained in:
WardPearce
2026-02-09 17:53:55 +13:00
parent 6c62071acd
commit 77a1fa07e2
2 changed files with 15 additions and 14 deletions
@@ -35,6 +35,7 @@
themeColorStore
} from '../../store';
import { addToast } from '../Toast.svelte';
import { tick } from 'svelte';
let invidiousInstance = $state(get(instanceStore));
let region = $state(get(interfaceRegionStore));
@@ -54,9 +55,10 @@
if (!color.hex) return;
if (colorPickerDebounce) clearTimeout(colorPickerDebounce);
colorPickerDebounce = setTimeout(() => {
setAmoledTheme();
colorPickerDebounce = setTimeout(async () => {
themeColorStore.set(color.hex);
await tick();
setAmoledTheme();
}, 10);
}
@@ -451,7 +453,7 @@
--cp-input-color: var(--surface);
--cp-button-hover-color: var(--surface-variant);
--slider-width: 50px;
--picker-width: 60vw;
--picker-width: 45vw;
width: 100%;
}
+10 -11
View File
@@ -97,23 +97,22 @@ menu {
}
.color-picker .picker {
display: none;
display: none !important;
}
.color-picker .wrapper {
padding: 0 !important;
margin: 0 !important;
}
.color-picker .thumb {
height: 20px;
width: 20px;
opacity: 0.5;
}
.color-picker div {
margin: 0;
padding: 0;
width: 100%;
height: 20px !important;
width: 20px !important;
opacity: 0.5 !important;
}
.color-picker .track {
border-radius: 0.25rem;
border-radius: 0.25rem !important;
}
.color-picker .h {