fix: systemPreferences.getAccentColor inverted color (#49067)
This commit is contained in:
parent
e8af0af9ab
commit
55467ea064
2 changed files with 11 additions and 2 deletions
|
|
@ -16,6 +16,7 @@
|
||||||
#include "base/win/wrapped_window_proc.h"
|
#include "base/win/wrapped_window_proc.h"
|
||||||
#include "shell/common/color_util.h"
|
#include "shell/common/color_util.h"
|
||||||
#include "shell/common/process_util.h"
|
#include "shell/common/process_util.h"
|
||||||
|
#include "skia/ext/skia_utils_win.h"
|
||||||
#include "ui/gfx/color_utils.h"
|
#include "ui/gfx/color_utils.h"
|
||||||
#include "ui/gfx/win/hwnd_util.h"
|
#include "ui/gfx/win/hwnd_util.h"
|
||||||
|
|
||||||
|
|
@ -88,7 +89,7 @@ std::string SystemPreferences::GetAccentColor() {
|
||||||
if (!color.has_value())
|
if (!color.has_value())
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
return hexColorDWORDToRGBA(color.value());
|
return ToRGBAHex(skia::COLORREFToSkColor(color.value()), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SystemPreferences::GetColor(gin_helper::ErrorThrower thrower,
|
std::string SystemPreferences::GetColor(gin_helper::ErrorThrower thrower,
|
||||||
|
|
|
||||||
|
|
@ -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';
|
import { expect } from 'chai';
|
||||||
|
|
||||||
|
|
@ -2559,6 +2559,14 @@ describe('BrowserWindow module', () => {
|
||||||
expect(accentColor).to.match(/^#[0-9A-F]{6}$/i);
|
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', () => {
|
it('returns the correct accent color after multiple changes', () => {
|
||||||
const w = new BrowserWindow({ show: false });
|
const w = new BrowserWindow({ show: false });
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue