Skip to content

electron-modules/electron-windows-titlebar

Repository files navigation

electron-windows-titlebar


NPM version CI node version npm download

windows-style title bar component for Electron

Native Addon Demo

Web API Demo

Contributors


xudafeng


sriting


snapre

This project follows the git-contributor spec, auto updated at Sun Dec 11 2022 23:02:29 GMT+0800.

Installment

npm i electron-windows-titlebar --save-dev

Use Native Addons

const windowTitleBar = require('electron-windows-titlebar');
const win = new BrowserWindow({
  width: 800,
  height: 600,
  title: 'addon demo',
})
const hwnd = win?.getNativeWindowHandle();
const setDark = true;
if (hwnd) {
  setDark ? windowTitleBar.switchDarkMode(hwnd) : windowTitleBar.switchLightMode(hwnd);
}

Use Web APIs

// renderer process: import electron-windows-titlebar renderer
import TitleBar from 'electron-windows-titlebar/TitleBar';

<TitleBar
/>

Run Demo

npm run dev:web

another shell

npm run dev:main

License

The MIT License (MIT)