Styles de fenêtre personnalisés
Fenêtre sans cadre

Une fenêtre sans cadre supprime tous les chrome appliqués par l'OS, y compris les contrôles de fenêtres.
Pour créer une fenêtre sans cadre, définissez le paramètre BaseWindowContructorOptions frame dans le constructeur de BrowserWindow à false.
- main.js
const { app, BrowserWindow } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 300,
height: 200,
frame: false
})
win.loadURL('https://example.com')
}
app.whenReady().then(() => {
createWindow()
})
Sur Wayland (Linux), les fenêtres sans cadre ont des ombres de drop GTK et des limites de redimension étendues
par défaut. Pour créer une fenêtre sans cadre avec aucune décoration
, définissez hasShadow: false dans les options du constructeur de fenêtre.
Fenêtres transparentes

To create a fully transparent window, set the BaseWindowContructorOptions transparent param in the BrowserWindow constructor to true.
The following fiddle takes advantage of a transparent window and CSS styling to create the illusion of a circular window.
- main.js
- index.html
- styles.css
const { app, BrowserWindow } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 100,
height: 100,
resizable: false,
frame: false,
transparent: true
})
win.loadFile('index.html')
}
app.whenReady().then(() => {
createWindow()
})
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
<link href="./styles.css" rel="stylesheet">
<title>Transparent Hello World</title>
</head>
<body>
<div class="white-circle">
<div>Hello World!</div>
</div>
</body>
</html>
body {
margin: 0;
padding: 0;
background-color: rgba(0, 0, 0, 0); /* Transparent background */
}
.white-circle {
width: 100px;
height: 100px;