Electron 和 Webkit 浏览器显示错误的颜色

问题描述

我正在使用 Electron 开发应用程序。我在 Adob​​e XD 中有一种颜色,例如 rgb(0,55,200)。当我在我的应用程序中设置此颜色时,Electron 显示不同的颜色:rgb(4,48,193)。

Adobe XD with correct values

Electron with wrong values

同样的情况在 Safari 和 Chrome 中发生,但 Firefox 显示正确的值。 更奇怪的是,使用 Electron 的应用程序 Visual Studio Code 显示正确的值(我在 vscode 中打开了 devtools,并检查了)。

我认为这可能是我的 Electron 版本。 vscode process.versions.electron 是 11.3.0,我的是 11.2.1。我更新到 11.4.4 还是一样。

我在另一台电脑上试过,颜色因不同的因素而偏离。

Electron 11.2.1 发生的一件非常奇怪的事情是,虽然站点中的颜色关闭,但当将颜色选择器指向 devtools 内的小颜色框时,颜色是正确的。您可以在第二个屏幕截图中看到此框,但屏幕截图来自版本 11.4.4,没有这种奇怪的行为。

我尝试了所有这些标志,但没有运气:

app.commandLine.appendSwitch('force-color-profile','srgb');
app.commandLine.appendSwitch('--disable-color-correct-rendering');
app.commandLine.appendSwitch('disable-features','ColorCorrectRendering');
app.commandLine.appendSwitch('disable-color-correct-rendering');
app.commandLine.appendSwitch('enable-color-correct-rendering','disabled');
app.commandLine.appendSwitch('--enable-color-correct-rendering=disabled');
app.commandLine.appendSwitch('--enable-color-correct-rendering','disabled');
app.commandLine.appendArgument('--enable-color-correct-rendering=disabled');

这不是显示器颜色配置文件的问题

如果我将颜色选择器模式更改为 sRGB,则 Electron 颜色几乎正确,但 Adob​​e XD 颜色完全关闭。 如果我将显示器颜色配置文件更改为 sRGB,则一切正常。但这不是解决方案,因为我无法要求我的应用程序用户更改她/他的颜色配置文件。而且,Firefox 和 vscode 运行良好。一定有办法。

欢迎任何建议。

感谢阅读!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...