You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request]: Use new 'Mica' material for BrowserWindow vibrancy in Windows 11 #29937
I agree to follow the Code of Conduct that this project adheres to.
I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Problem Description
At the moment, setVibrancy() for BrowserWindow only supports macOS. Windows 10 has had a similar material called Acrylic, but Electron is yet to add support for it.
Proposed Solution
With Windows 11, Microsoft is introducing a more performant material dubbed Mica.
Mica is an opaque, dynamic material that incorporates theme and desktop wallpaper to paint the background of long-lived windows such as apps and settings. You can apply Mica to your application backdrop to delight users and create visual hierarchy, aiding productivity, by increasing clarity about which window is in focus. Mica is specifically designed for app performance as it only samples the desktop wallpaper once to create its visualization.
The new Mica material is a prominent part of the Windows 11 visual design. Adding support for Mica to setVibrancy() in Electron would greatly elevate the design of many apps, and enable the visual look of Electron apps to be in line with modern Windows experiences.
Alternatives Considered
The following libraries currently allow apps to use Acrylic as an alternative to vibrancy in Windows 10:
Reacted by paulobrien, Ben Lee, Yannick, Mihajlo Marjanović, petteriusa, Artur Jurgas, Estéban, Alexander, Rayo Verweij, Akanksh29 and 62 more
Reacted by Hayder, Gaëtan Dezeiraud, FireCubeStudios, Lasse Rosenow, Jaiganesh Kumaran and KytoSai
Reacted by Akanksh29, Tijmen Ennik, Alan Ninan Thomas, Hayder, dehydratedpotato, Gaëtan Dezeiraud, FireCubeStudios, twisted-nematic57, Lasse Rosenow, Jaiganesh Kumaran and 4 more
Reacted by Mihajlo Marjanović, Akanksh29, Sayed Arif Uddin Pallab, Alan Ninan Thomas, Facundo Paredes, Hayder, Sonny Lazuardi, Gaëtan Dezeiraud, FireCubeStudios, twisted-nematic57 and 5 more
hi @codebytere, this is amazing -- thank you so much! After having a quick look over the code for the PR, it seems this is adding Acrylic support for vibrancy.
Can we expect Mica support in the future? Having an option to choose between Acrylic and Mica for vibrancy would be ideal. I am not sure if Microsoft even provides the APIs for implementing Mica on Win32 apps yet, so I understand if it's simply not possible to add Mica support yet :)
Reacted by Alan Ninan Thomas, Sonny Lazuardi, Gaëtan Dezeiraud, Diego Pierangeli and FireCubeStudios
Mica for long lived surfaces (like app background) and Acrylic for short lived surfaces (like context menus) is how Microsoft's documentation recommends to use them.
Reacted by Adolfo Jayme-Barrientos, 0xENDER and Edgar Chinchilla
@MehediH yeah that's the constraint for now sadly - Mica isn't yet available for Win32 apps yet. Once it becomes possible i'd plan to update that codepath to take it into account and allow you all to select it :)
Reacted by Alan Ninan Thomas, mehedi, Thomas Kam, 0xENDER and l.j
I wrote those Acrylic hacks; they are not supported by Microsoft and introduce a number of problems. DO NOT use them in mainline Electron.
Mica should get supported APIs soon. Perhaps as part of that effort, the correct Acrylic path will get documented. (I'm connected to the team and will continue to be a very loud squeaky wheel.)
Reacted by Thomas Kam, Peichao Lai, Hitesh and Micah Lindley
Reacted by George Petrov, Thomas Kam, Hayder, Mitchell Cohen, Gaëtan Dezeiraud, Amr Bashir, Hitesh, theolivenbaum, Lőrik Levente, Nouvistiardi Azra and 3 more
I was able to get Mica/Acrylic working in an Electron fork but I ran into a few issues.
Electron disables resizing and maximizing for windows with transparent: true, which is required for acrylic effects to work.
titleBarStyle: hidden breaks acrylic effects. I'm not sure how exactly Electron hides the titlebar in a way that breaks it, but I've gotten Mica working with hidden titlebars in another project using these window styles:
transparent: true is not required for the effects to work. In my experience, simply not setting a background color to the web page and ensuring every element on top does not use a non transparent color is sufficient. Not using transparent: true also allows window snapping and shadows to keep working.
transparent: true is not required for the effects to work. In my experience, simply not setting a background color to the web page and ensuring every element on top does not use a non transparent color is sufficient. Not using transparent: true also allows window snapping and shadows to keep working.
Sure enough, setting backgroundColor: '#00000000' in JS and background: unset !important for <html> and <body> gave me a resizable window!
Though the titlebar is missing (even with titleBarStyle: 'default'), the window cannot be moved with -webkit-app-region: drag, there is a ~6px space of nothing at the top of the window, and any titleBarStyle other than default breaks it completely:
I was able to get Mica/Acrylic working in an Electron fork but I ran into a few issues.
titleBarStyle: hidden breaks acrylic effects. I'm not sure how exactly Electron hides the titlebar in a way that breaks it, but I've gotten Mica working with hidden titlebars in another project using these window styles:
That's the bummer here, any way to get mica to work with a hidden title bar?
Activity
paulobrien commentedon Jun 29, 2021
Good plan, it definitely makes a lot of sense to support this in Electron natively.
codebytere commentedon Jun 29, 2021
Interesting! i can try to poke into this if i have some time :)
codebytere commentedon Jul 28, 2021
hey folks - put up a PR to get this added into Electron 🌟
MehediH commentedon Jul 28, 2021
hi @codebytere, this is amazing -- thank you so much! After having a quick look over the code for the PR, it seems this is adding Acrylic support for vibrancy.
Can we expect Mica support in the future? Having an option to choose between Acrylic and Mica for vibrancy would be ideal. I am not sure if Microsoft even provides the APIs for implementing Mica on Win32 apps yet, so I understand if it's simply not possible to add Mica support yet :)
just1a-person commentedon Jul 28, 2021
Mica for long lived surfaces (like app background) and Acrylic for short lived surfaces (like context menus) is how Microsoft's documentation recommends to use them.
codebytere commentedon Jul 28, 2021
@MehediH yeah that's the constraint for now sadly - Mica isn't yet available for Win32 apps yet. Once it becomes possible i'd plan to update that codepath to take it into account and allow you all to select it :)
MehediH commentedon Jul 28, 2021
@codebytere Understood. Thank you for the work on this!!
riverar commentedon Jul 28, 2021
I wrote those Acrylic hacks; they are not supported by Microsoft and introduce a number of problems. DO NOT use them in mainline Electron.
Mica should get supported APIs soon. Perhaps as part of that effort, the correct Acrylic path will get documented. (I'm connected to the team and will continue to be a very loud squeaky wheel.)
thomassth commentedon Jul 28, 2021
I think the latest MS edge (dev?) builds uses Mica already, so electron should be able to tap into the same API?
gaetandezeiraud commentedon Oct 21, 2021
API available with
dwmapi.dllfor win32.Just not documented and define in
dwmapi.h.mitchchn commentedon Oct 22, 2021
I threw together a native module that sets
DWMWA_MICA_EFFECTas @Brouilles described, and sure enough... Mica in Electron:But there are some issues to resolve:
{transparent: true, frame: true}which is an invalid combination for Windows.gaetandezeiraud commentedon Oct 22, 2021
Great job @mitchchn! I have also seen in my test than the title in the title bar have a solid background color. Don't know why.
11 remaining items
decahedron1 commentedon Jun 30, 2022
I was able to get Mica/Acrylic working in an Electron fork but I ran into a few issues.
transparent: true, which is required for acrylic effects to work.titleBarStyle: hiddenbreaks acrylic effects. I'm not sure how exactly Electron hides the titlebar in a way that breaks it, but I've gotten Mica working with hidden titlebars in another project using these window styles:style = WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU | WS_SIZEBOX | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_VISIBLEstyle_ex = WS_EX_WINDOWEDGEsylveon commentedon Jul 23, 2022
transparent: true is not required for the effects to work. In my experience, simply not setting a background color to the web page and ensuring every element on top does not use a non transparent color is sufficient. Not using transparent: true also allows window snapping and shadows to keep working.
decahedron1 commentedon Jul 23, 2022
Sure enough, setting
backgroundColor: '#00000000'in JS andbackground: unset !importantfor<html>and<body>gave me a resizable window!Though the titlebar is missing (even with

titleBarStyle: 'default'), the window cannot be moved with-webkit-app-region: drag, there is a ~6px space of nothing at the top of the window, and any titleBarStyle other thandefaultbreaks it completely:GregVido commentedon Sep 29, 2022
if you are using windows 11, you can use https://www.npmjs.com/package/mica-electron ;)
GregVido commentedon Sep 29, 2022
what is your windows 11 version ?
GregVido commentedon Oct 7, 2022
And if you update windows to 22h2 and try with last version of mica electron, no work too ?
Stanzilla commentedon Nov 2, 2023
That's the bummer here, any way to get mica to work with a hidden title bar?
Remove `transparent: true` for transparencyOption
d-o0o-b commentedon Feb 19, 2024
It might be help you!