JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 187
  • Score
    100M100P100Q78205F
  • License MIT

Add vibrancy effect for electron

Package Exports

  • electron-acrylic-window

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (electron-acrylic-window) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

electron-acrylic-window

logo

Build Status Dependencies npm version

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.

Download

You should install Visual studio or Visual C++ build tools before install this.

npm i electron-acrylic-window --save

Screenshots

Screenshot1

Usage

BrowserWindow

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

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.

Errors

  • WINDOW_NOT_GIVEN
    Error that occurs when win parameter is not passed.
  • NOT_VALID_WINDOW
    Error that occurs when win parameter is not valid Electron window.
  • FAIL_LOAD_DLL
    Error that occurs when fails to load SetWindowCompositionAttribute from user32.dll
  • UNKNOWN
    Unknown error.

disableVibrancy

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.

Errors

  • WINDOW_NOT_GIVEN
    Error that occurs when win parameter is not passed.
  • NOT_VALID_WINDOW
    Error that occurs when win parameter is not valid Electron window.
  • UNKNOWN
    Unknown error.

Example

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

let win;

function createWindow() {
    win = new BrowserWindow({
        width: 800,
        height: 600,
        frame: false,
        transparent: true,
        vibrancy: 'light'
    });
    win.loadURL(`file://${__dirname}/index.html`);
    setTimeout(()=>{
        win.setVibrancy();
    }, 3000);
}

app.on('ready', createWindow);