Effect
This namespace supports changing window transparency/translucent effect.
Effect.current
stringsince v1.0.1A read-only property that returns the currently applied effect or null
if no effect has been applied.
Available effects: mica
, acrylic
, unified
and blurbehind
.
Example:
console.log(Effect.current)
// mica
Effect.apply(name, options?)
functionsince v1.0.1A function that takes the name of the desired effect name and an optional object.
It returns a boolean indicating whether the effect was successfully applied or not.
Parameters:
name
[required] These effect names above to be applied, in string.options
[optional] Additional options for the effect,acrylic
,unified
andblurbehind
could have tint color, butmica
will ignore this options.
This function returns false
if the effect could not be applied, see the System compatibility below.
Example:
// enable acrylic on Windows 10
Effect.apply('acrylic')
// with a tint color
Effect.apply('unified', { color: '#4446' })
// mica on windows 11, no options needed
Effect.apply('mica')
INFO
Tint colors must be in CSS hex color format, e.g. #RGB, #RGBA, #RRGGBB, #RRGGBBAA.
To see transparency effect correctly, you should remove all lowest backgrounds.
Effect.clear()
functionsince v1.0.1A function that clears any currently applied effect, then the Client background will be black.
Using Effect.current
after clearing will give you undefined
.
Example:
// just clear applied effect, even if nothing applied
Effect.clear()
System compatibility
- On Windows 7, only the
blurbehind
is supported. - On Windows 10, requires build 1703 or higher to use
acrylic
. mica
andunified
are only supported on Windows 11, butunified
can be enabled on Windows 10 without different fromacrylic
.
WARNING
On Windows 10 build 1903 (19H1) and higher, enabling acrylic/mica/unified
with Transparency effects (in Personalize -> Color settings) will cause lag when moving the Client window.
Listening for changes
Add a listener which will be triggered when effect changed.
window.addEventListener('effect-changed', (event) => {
console.log(event.detail)
})