Razdom
Razdom

Reputation: 137

Add colored titlebar in Electron

Im using node.js and electron to create a desktop app. I try to change the color of my titlebar with electron-titlebar-windows packge.

I add to my code that lines:

const ElectronTitlebarWindows = require('electron-titlebar-windows');
const titlebar = new ElectronTitlebarWindows();

but its trow an error:

App threw an error during load
ReferenceError: document is not defined

How to use this package?

Upvotes: 1

Views: 1905

Answers (1)

Neil P.
Neil P.

Reputation: 1114

I ran into the same issue. The problem is that you are declaring ElectronTitlebarWindows & the titlebar in the main (a.k.a background) process where you need to declare & use them in the renderer process. Since the background process will not have the reference to the document, which is the ReferenceError that you're seeing.

Upvotes: 1

Related Questions