Skip to content

Commit

Permalink
Add Custom Scrollbar index.js
Browse files Browse the repository at this point in the history
Added Custom Scrollbar. (To both server app and electron wrap, with webContents.insertCSS() method.
  • Loading branch information
sipsuru authored Nov 13, 2024
1 parent eafb9d3 commit d73a75e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function createWindow() {
})

mainWindow.on('ready-to-show', () => {
doInjectScrollBar()
mainWindow.show()
})

Expand All @@ -31,6 +32,31 @@ function createWindow() {
mainWindow.loadURL("http://localhost:3000");
}

function doInjectScrollBar(): void {
const cddData = `
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: #2a2a2a;
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
background-color: #555555;
border-radius: 10px;
border: 2px solid #2a2a2a;
}
::-webkit-scrollbar-thumb:hover {
background-color: #777777;
}`

mainWindow.webContents.insertCSS(cddData).then(() => {})
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
Expand Down

0 comments on commit d73a75e

Please sign in to comment.