npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

electron-liquid-glass

v1.1.1

Published

macOS glass / vibrancy wrapper for Electron BrowserWindow

Downloads

855

Readme

electron-liquid-glass

npm npm downloads GitHub Platform Node

Modern macOS glass effects for Electron applications

🪄 NATIVE NSGlassEffectView integration with ZERO CSS hacks

InstallationQuick StartAPIExamplesContributing


✨ Features

  • 🪟 Native Glass Effects - Real NSGlassEffectView integration, not CSS approximations
  • Zero Configuration - Works out of the box with any Electron app
  • 🎨 Fully Customizable - Corner radius, tint colors, and glass variants
  • 📦 Modern Package - Dual ESM/CommonJS support with TypeScript declarations
  • 🔧 Pre-built Binaries - No compilation required for standard setups
  • 🌙 Auto Dark Mode - Automatically adapts to system appearance changes

🚀 Installation

# npm
npm install electron-liquid-glass

# yarn
yarn add electron-liquid-glass

# pnpm
pnpm add electron-liquid-glass

# bun
bun add electron-liquid-glass

Requirements

  • macOS 26+ (Tahoe or later)
  • Electron 30+
  • Node.js 22+

Note: This package only works on macOS. On other platforms, it provides safe no-op fallbacks.

🎯 Quick Start

Basic Usage

import { app, BrowserWindow } from "electron";
import liquidGlass from "electron-liquid-glass";

app.whenReady().then(() => {
  const win = new BrowserWindow({
    width: 800,
    height: 600,

    vibrancy: false, // <-- ❌❌❌ do NOT set vibrancy alongside with liquid glass, it will override and look blurry

    transparent: true, // <-- This MUST be true
  });

  win.setWindowButtonVisibility(true); // <-- ✅ This is required to show the window buttons

  win.loadFile("index.html");

  /**
   * 🪄 Apply glass effect after content loads 🪄
   */
  win.webContents.once("did-finish-load", () => {
    // 🪄 Apply effect, get handle
    const glassId = liquidGlass.addView(win.getNativeWindowHandle(), {
      /* options */
    });

    // Experimental, undocumented private APIs
    liquidGlass.unstable_setVariant(glassId, 2);
  });
});

TypeScript Usage

import { BrowserWindow } from "electron";
import liquidGlass, { GlassOptions } from "electron-liquid-glass";

const options: GlassOptions = {
  cornerRadius: 16, // (optional)
  tintColor: "#44000010", // black tint (optional)
  opaque: true, // add opaque background behind glass (optional)
};

liquidGlass.addView(window.getNativeWindowHandle(), options);

📚 API Reference

liquidGlass.addView(handle, options?)

Applies a glass effect to an Electron window.

Parameters:

  • handle: Buffer - The native window handle from BrowserWindow.getNativeWindowHandle()
  • options?: GlassOptions - Configuration options

Returns: number - A unique view ID for future operations

GlassOptions

interface GlassOptions {
  cornerRadius?: number; // Corner radius in pixels (default: 0)
  tintColor?: string; // Hex color with optional alpha (#RRGGBB or #RRGGBBAA)
  opaque?: boolean; // Add opaque background behind glass (default: false)
}

UNDOCUMENTED EXPERIMENTAL METHODS

⚠️ Warning: DO NOT USE IN PROD. These methods use private macOS APIs and may change in future versions.

// Glass variants (number) (0-15, 19 are functional)
liquidGlass.unstable_setVariant(glassId, 2);

// Scrim overlay (0 = off, 1 = on)
liquidGlass.unstable_setScrim(glassId, 1);

// Subdued state (0 = normal, 1 = subdued)
liquidGlass.unstable_setSubdued(glassId, 1);

🔧 Development

Building from Source

# Clone the repository
git clone https://github.com/meridius-labs/electron-liquid-glass.git
cd electron-liquid-glass

# Install dependencies
bun install

# Build native module
bun run build:native

# Build TypeScript library
bun run build

# Build everything
bun run build:all

Rebuilding for Custom Electron

If you're using a custom Electron version:

npx electron-rebuild -f -w electron-liquid-glass

Project Structure

electron-liquid-glass/
├── src/                 # Native C++ source code
│   ├── glass_effect.mm  # Objective-C++ implementation
│   └── liquidglass.cc   # Node.js addon bindings
├── js/                  # TypeScript source
│   ├── index.ts         # Main library code
│   └── native-loader.ts # Native module loader
├── dist/                # Built library (generated)
├── examples/            # Example applications
└── prebuilds/          # Pre-built binaries

🏗️ How It Works

  1. Native Integration: Uses Objective-C++ to create NSGlassEffectView instances
  2. View Hierarchy: Inserts glass views behind your web content, not over it
  3. Automatic Updates: Listens for system appearance changes to keep effects in sync
  4. Memory Management: Properly manages native view lifecycle

Technical Details

  • Primary: Uses NSGlassEffectView API when available
  • Fallback: Falls back to public NSVisualEffectView on older systems
  • Performance: Minimal overhead, native rendering performance
  • Compatibility: Works with all Electron window configurations

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and test thoroughly
  4. Commit with conventional commits: git commit -m "feat: add amazing feature"
  5. Push and create a Pull Request

Reporting Issues

  • Use the issue tracker
  • Include your macOS version, Electron version, and Node.js version
  • Provide a minimal reproduction case when possible

📋 Roadmap

  • [ ] View Management - Remove and update existing glass views

🙏 Acknowledgments

  • Apple's private NSGlassEffectView API documentation (reverse-engineered)
  • The Electron team for excellent native integration capabilities
  • Contributors and users who help improve this library

📄 License

MIT © Meridius Labs 2025


Made with ❤️ for the Electron community

⭐ Star on GitHub🐛 Report Bug💡 Request Feature