seo-rii / electron-acrylic-window

Add acrylic effect to your electron application
MIT License
279 stars 22 forks source link
arcylic electron fluent-design nodejs vibrancy windows

Thank you so much for your interest in this project. This project is archived because Electron supports acrylic backgrounds as native. If you want, please fork this project to create a new one. Thank you!


logo

electron-acrylic-window

Build Status Libraries.io dependency status for latest release npm version

Makes it simple to add the Windows 10 Acrylic effect to Electron applications, by acting as a wrapper for the standard Electron vibrancy feature.

Only affects Windows 10. If the OS is not Windows 10, it will fall back on the original vibrancy function.

Inspired by electron-vibrancy.

screenshotscreenshot

Contributors

Huge thanks to all contributors!

Installation

You will need Visual Studio or Visual C++ build tools to install this. An easy way to install them can be found here.

yarn add electron-acrylic-window

Usage

BrowserWindow - Wrapper class for electron.BrowserWindow

Enables Vibrancy on the Electron window.

const {BrowserWindow} = require("electron-acrylic-window");

win = new BrowserWindow({
    ...,
    frame: false,
    vibrancy: [options] // See below
});

If OS is Windows 10, it overrides the constructor option and BrowserWindow.setVibrancy method to work properly on Windows 10. If OS is not Windows 10, it will work normally.

setVibrancy - Wrapper function for electron.BrowserWindow.setVibrancy

Enables Vibrancy on the Electron window.

const { setVibrancy } = require('electron-acrylic-window')

setVibrancy(win, [options])

// OR

win.setVibrancy([options])

win should be frameless.

Will call original win.setVibrancy(op) Electron function if OS is not Windows 10.

There is no return value. If it fails to set vibrancy, it throws an error.

Errors

Options

If OS is not Windows 10, [options] will be passed on to the original vibrancy function/option, so keep that in mind.

On Windows 10, [options] should be a String or an Object.

Demo

To run the demo Electron application, clone this repository, install the dependencies and run the test script:

git clone https://github.com/Seo-Rii/electron-acrylic-window.git
cd electron-acrylic-window
yarn install
yarn run test