fix: systemPreferences.getAccentColor inverted color (#49066)

This commit is contained in:
Shelley Vohr
2025-11-25 22:47:09 +01:00
committed by GitHub
parent 32fcfe4505
commit 822fb2cd4d
2 changed files with 11 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
import { app, BrowserWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, net, protocol, screen, webContents, webFrameMain, session, WebContents, WebFrameMain } from 'electron/main';
import { app, BrowserWindow, BrowserView, dialog, ipcMain, OnBeforeSendHeadersListenerDetails, net, protocol, screen, webContents, webFrameMain, session, systemPreferences, WebContents, WebFrameMain } from 'electron/main';
import { expect } from 'chai';
@@ -2606,6 +2606,14 @@ describe('BrowserWindow module', () => {
expect(accentColor).to.match(/^#[0-9A-F]{6}$/i);
});
it('matches the systemPreferences system color when true', () => {
const w = new BrowserWindow({ show: false });
w.setAccentColor(true);
const accentColor = w.getAccentColor() as string;
const systemColor = systemPreferences.getAccentColor().slice(0, 6);
expect(accentColor).to.equal(`#${systemColor}`);
});
it('returns the correct accent color after multiple changes', () => {
const w = new BrowserWindow({ show: false });