Skip to content

Commit 32fd5a3

Browse files
committed
Add dynamic backdrop blur to Window component
Introduces a computed backdrop blur effect based on the theme background's opacity. The blur increases as the background becomes more transparent, enhancing visual depth.
1 parent 89ab4f7 commit 32fd5a3

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

components/Window.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
marginLeft: `${settings.marginLeft}px`,
2222
marginRight: `${settings.marginRight}px`,
2323
backgroundColor: settings.themeBackground,
24+
backdropFilter: backdropBlur,
2425
'--window-border-width': borderWidth,
2526
'--window-border-color': borderColorRgba,
2627
}"
@@ -369,6 +370,20 @@ const shineWidth = computed(() => `${props.settings.shineWidth}%`);
369370
const shineHeight = computed(() => props.settings.shineHeight);
370371
const shineOpacity = computed(() => props.settings.shineOpacity);
371372
373+
const backdropBlur = computed(() => {
374+
// Extract alpha from the themeBackground color (which already has opacity applied)
375+
const color = chroma(props.settings.themeBackground);
376+
const alpha = color.alpha();
377+
378+
// Calculate blur amount: more blur as opacity decreases
379+
// When alpha is 1 (fully opaque), blur is 0
380+
// When alpha is 0 (fully transparent), blur is at maximum (20px)
381+
const maxBlur = 20;
382+
const blurAmount = (1 - alpha) * maxBlur;
383+
384+
return blurAmount > 0 ? `blur(${blurAmount}px)` : 'none';
385+
});
386+
372387
watch(title, (title) => emit('update:title', title));
373388
374389
watch(

0 commit comments

Comments
 (0)