Simply add vibrancy effect to Electron application on Windows.
Works only on Windows 10. If os is not Windows 10, it will call original function.
Inspired from electron-vibrancy
.
You should install Visual studio or Visual C++ build tools before install this.
npm i electron-acrylic-window --save
Wrapper class for BrowserWindow
.
If OS is not Windows 10, it works perfectly the same.
If OS is Windows 10, it overrides construtor option and setVibrancy
method to work properly on Windows 10.
setVibrancy(win, op = null);
Enables Vibrancy to window.
There is no return value. If it fails to set vibrancy, it throws error.
win
should be frameLess, and transparent.
This function will call win.setVibrancy(op)
if os is not Windows 10.
On Windows 10, op should be 'light', 'dark', or 'appearance-based'.
If not, it'll set as 'appearance-based'.
- WINDOW_NOT_GIVEN
Error that occurs whenwin
parameter is not passed. - NOT_VALID_WINDOW
Error that occurs whenwin
parameter is not valid Electron window. - FAIL_LOAD_DLL
Error that occurs when fails to load SetWindowCompositionAttribute from user32.dll - UNKNOWN
Unknown error.
- Deprecated, and will be removed on v1.0.0.
disableVibrancy(win);
Disables Vibrancy to window.
There is no return value. If it fails to disable vibrancy, it throws error.
win
should be frameLess, and transparent.
This function will call win.setVibrancy(null)
if os is not Windows 10.
- WINDOW_NOT_GIVEN
Error that occurs whenwin
parameter is not passed. - NOT_VALID_WINDOW
Error that occurs whenwin
parameter is not valid Electron window. - FAIL_LOAD_DLL
Error that occurs when fails to load binary module. - UNKNOWN
Unknown error.
Clone this Repository and run npm run-script test
.