You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Chrome and Electron render colors differently #10732
Colors set in CSS should render the same in Electron as they do in Chrome.
Actual behavior
Colors look different. See image:
How to reproduce
Set the background-color of an element of an Electron app to rgb( 126, 183, 253 ). Compare the color rendered by Electron to the same color as rendered in Chrome.
In your Electron app do not set vibrancy, and do not set background color via the BrowserWindow API.
Notice as well that if you take a screenshot and draw a rectangle of the same RGB in a drawing program it will match Chrome's color, not Electron.
Consequences
Please note this is not a trivial issue for those of us using Electron to create apps intended for design. Something that looks "right" to the user in an electron-based design app can look subtly different and "wrong" when they export their design and open it in a regular browser.
Thanks :)
Reacted by Haukur Páll Hallvarðsson, Steffen Bruchmann, Augus, 寂寞如雪, Akash, Ed Hinchliffe, Sindre Sorhus, Abhigyan Khaund, Toby, Jake Klingler and 16 more
Chrome as of 61 started (finally!) respecting the color profile that the OS specifies on all desktop platforms. As a consequence, CSS specification of the color ##ABCDEF, when drawn to the screen, will not necessarily be ##ABCDEF -- it will depend on the monitor that you draw it on.
As chromium 61 is now in the latest master, this problem should be resolved. I'm going to go ahead and close this, but please feel free to @ me if it should persist.
@codebytere doesn't seem to be fixed. Here is the color #1D89CB. Left is Electron 2.0.0-beta.7, right is Electron 1.6.6, and bottom is Chrome 66. All are totally different.
Method: set background colors on Electron and Chrome via devtools. Screenshoted and opened in Sketch to add a control rect using the same color. I opened Electron by clicking on it after downloading. I did not set any flags.
@deanylev any ideas how you got the result you got?
As chromium 61 is now in the latest master, this problem should be resolved. I'm going to go ahead and close this, but please feel free to @ me if it should persist.
@codebytere: Based on the recent comments, and the reports we're seeing related to Atom using Electron 2.0 (atom/atom#17356), this problem seems to still be alive and well. 😬 Would it make sense to reopen this issue?
Co-editor of the CSS Color specification here. 👋🏼 A bit late to the party.
There seems to be some confusion in this thread regarding hex colors and color management. In CSS, hex colors should always be resolved in sRGB, per spec. It's not implementation-dependent, and has nothing to do with OS or user settings. It is not that Chrome, Safari and Firefox have decided differently, Chrome and Safari have both changed their behavior to follow the specification years ago, while Firefox still hasn't (though it can be enabled via a config flag, and will eventually become the default).
It is understandable that if someone is only accustomed to specifying color through hex colors, it may be frustrating to them that if these are processed correctly, they cannot be used to specify about one third of their screen’s colors (since most screens today are roughly P3). There are however other color formats in CSS that are not gamut-restricted, such as Lab and LCH colors. And there are Display P3 RGB colors too for those who want to use RGB coordinates.
However, all specified CSS colors are device independent. There is no color format that just throws raw RGB coordinates at the screen, and this is by design. This ensures portability, i.e. that colors specified on my device are the same on everyone else's devices (assuming the device is capable of displaying them). Having a setting that makes CSS colors render incorrectly defeats the purpose, and it's even worse if that's the default value!
Reacted by Jarek Radosz, Marc Edwards, Mauricio Palma, Scott and Darryl Noakes
As chromium 61 is now in the latest master, this problem should be resolved. I'm going to go ahead and close this, but please feel free to @ me if it should persist.
It is possible that it is be broken again in 16.0.7? It looks like that if the switch is active, electron converts data and uses sRGB to displaySpace even if the image data are still in displaySpace.
I am using Cypress with Electron 94. The colors are displaying correctly in browser. But once screenshot is taken, using the browser, the colors are washed out. The same is happening with Chrome 98. disable-color-correct-rendering has no effects on this behavior.
On the other hand Firefox 97 displays the colors correctly and screenshots have the same colors as well.
Is it the case that disable-color-correct-rendering doesn't translate to the builtin screenshot capturing tool?
EDIT: This behavior with screenshots in chromium is consistent while running browser outside of Cypress as well.
Correction screenshots from firefox also are off in color, but not that much as from chromium.
EDIT: Correction to correction. Actually the colors of the screenshot from firefox seem to be ok. The OS image viewer confused me and I taught there was a difference (probs this one is also using color correction).
I've dived a bit deeper. The issues with screenshots is not affected in any way by the disable-color-correct-rendering or the force-color-space options. The idea is that:
if you take screenshot using Page.captureScreenshot command or by running window.webContents.capturePage(), colors will be washed
if you take screenshot using devtools [ctrl+shift+i] [ctrl+shift+p] and search Screenshot, colors are ok
Now figuring based on this my hunch is that:
either electron does some processing in first case
or the chromium devtools does additional processing on image before saving, or different params for generation
I've cloned chromium and attempted to find some information about this, but couldn't. Question is where should I open a bug? In electron or chromium. Need the input of someone who can look around in chromium.
This has caused me heartaches, I'm using cypress 10.3, and this patch isn't available for electron.
I've upgraded cypress version to 13.6.4, and still, not working.
I encountered this issue with the latest Electron, alongside a recent Chromium, on linux (Debian testing). The application is rendering with WebGPU with a Vulkan back-end.
Chromium on the left, Electron on the right:
I found that forcing srgb colour profile worked around it:
Activity
teleclimber commentedon Oct 11, 2017
Confirmed that this problem does not occur on Windows:
thomastvedt commentedon Nov 1, 2017
same problem here..
esprehn commentedon Nov 2, 2017
This sounds like color profile support not being hooked up properly, though I'm not sure how. ccameron (at) chromium.org can probably help.
ccameron-chromium commentedon Nov 2, 2017
Chrome as of 61 started (finally!) respecting the color profile that the OS specifies on all desktop platforms. As a consequence, CSS specification of the color ##ABCDEF, when drawn to the screen, will not necessarily be ##ABCDEF -- it will depend on the monitor that you draw it on.
If you don't want this behavior, the following document shows how to delete your OS color profile settings (which gets you back to the old behavior), and also how to tell Chrome to ignore your OS color profile settings:
https://docs.google.com/document/d/1jMokB_OBkZVELu22li8vnHxAUoL1eGnLedP-1Gttv40/edit
Augus commentedon Nov 23, 2017
same problem here...
codebytere commentedon Apr 14, 2018
As chromium 61 is now in the latest master, this problem should be resolved. I'm going to go ahead and close this, but please feel free to @ me if it should persist.
deanylev commentedon Apr 25, 2018
@codebytere doesn't seem to be fixed. Here is the color #1D89CB. Left is Electron 2.0.0-beta.7, right is Electron 1.6.6, and bottom is Chrome 66. All are totally different.
teleclimber commentedon Apr 25, 2018
Not sure. It might be fixed. Here is what I get:
Method: set background colors on Electron and Chrome via devtools. Screenshoted and opened in Sketch to add a control rect using the same color. I opened Electron by clicking on it after downloading. I did not set any flags.
@deanylev any ideas how you got the result you got?
Skeukry commentedon May 13, 2018
On Linux, in electron v1.8.6 colors are correct, but in v2.0.0 they are off.
By correct I mean IntelliJ, Inkscape and Chrome 66 render this way.
ryran commentedon May 17, 2018
For the record, one more Linux user (Fedora) here who has the funky colors in Electron 2 (after updating atom to latest beta).
jasonrudolph commentedon May 18, 2018
@codebytere: Based on the recent comments, and the reports we're seeing related to Atom using Electron 2.0 (atom/atom#17356), this problem seems to still be alive and well. 😬 Would it make sense to reopen this issue?
33 remaining items
castroCrea commentedon Apr 2, 2021
On electron 11.2.3 I still have a difference on RGB green
I tried
Any help on this ?
LeaVerou commentedon Aug 3, 2021
Co-editor of the CSS Color specification here. 👋🏼 A bit late to the party.
There seems to be some confusion in this thread regarding hex colors and color management. In CSS, hex colors should always be resolved in sRGB, per spec. It's not implementation-dependent, and has nothing to do with OS or user settings. It is not that Chrome, Safari and Firefox have decided differently, Chrome and Safari have both changed their behavior to follow the specification years ago, while Firefox still hasn't (though it can be enabled via a config flag, and will eventually become the default).
It is understandable that if someone is only accustomed to specifying color through hex colors, it may be frustrating to them that if these are processed correctly, they cannot be used to specify about one third of their screen’s colors (since most screens today are roughly P3). There are however other color formats in CSS that are not gamut-restricted, such as Lab and LCH colors. And there are Display P3 RGB colors too for those who want to use RGB coordinates.
However, all specified CSS colors are device independent. There is no color format that just throws raw RGB coordinates at the screen, and this is by design. This ensures portability, i.e. that colors specified on my device are the same on everyone else's devices (assuming the device is capable of displaying them). Having a setting that makes CSS colors render incorrectly defeats the purpose, and it's even worse if that's the default value!
nornagon commentedon Aug 3, 2021
@LeaVerou FWIW I believe some users—Figma and perhaps VS Code—still want to disable color-correction due to https://crbug.com/634542 and https://crbug.com/711107 being outstanding (i.e. that these features aren't controllable in WebGL/Canvas). No idea if that's a correct intention or not but that's the stated reason why @poiru is maintaining a patch for it!
codingedgar commentedon Nov 10, 2021
@castroCrea did you manage to fix this?
Edit
worked for me for electron v11.0.1
@codebytere this is still an issue today
Also, I don't see any of the flags mentioned in this thread documented here: https://www.electronjs.org/docs/latest/api/command-line-switches, can someone please point me to where they are documented?
castroCrea commentedon Nov 10, 2021
@codingedgar for me adding only
works on electron from 11 to 15
LoboTheDark commentedon Jan 24, 2022
It is possible that it is be broken again in 16.0.7? It looks like that if the switch is active, electron converts data and uses sRGB to displaySpace even if the image data are still in displaySpace.
archfz commentedon Mar 5, 2022
I am using Cypress with Electron 94. The colors are displaying correctly in browser. But once screenshot is taken, using the browser, the colors are washed out. The same is happening with Chrome 98.
disable-color-correct-renderinghas no effects on this behavior.On the other hand Firefox 97 displays the colors correctly and screenshots have the same colors as well.
Is it the case that
disable-color-correct-renderingdoesn't translate to the builtin screenshot capturing tool?EDIT: This behavior with screenshots in chromium is consistent while running browser outside of Cypress as well.
archfz commentedon Mar 6, 2022
Correction screenshots from firefox also are off in color, but not that much as from chromium.
EDIT: Correction to correction. Actually the colors of the screenshot from firefox seem to be ok. The OS image viewer confused me and I taught there was a difference (probs this one is also using color correction).
archfz commentedon Mar 7, 2022
I've dived a bit deeper. The issues with screenshots is not affected in any way by the
disable-color-correct-renderingor theforce-color-spaceoptions. The idea is that:Page.captureScreenshotcommand or by runningwindow.webContents.capturePage(), colors will be washedScreenshot, colors are okNow figuring based on this my hunch is that:
I've cloned
chromiumand attempted to find some information about this, but couldn't. Question is where should I open a bug? In electron or chromium. Need the input of someone who can look around in chromium.Flashwalker commentedon Apr 22, 2022
It's all about the color profile of the monitor, as mentioned here #10732 (comment)
Disabling this option makes colors the same
Also in Chrome you can play with chrome://flags/#force-color-profile
krema commentedon Jul 29, 2022
Electron fixed/patched the
disable_color_correct_renderingwith release v18.3.6.#35050
gregoripolak commentedon Jul 18, 2024
This has caused me heartaches, I'm using cypress
10.3, and this patch isn't available for electron.I've upgraded cypress version to
13.6.4, and still, not working.slowriot commentedon Nov 27, 2024
I encountered this issue with the latest Electron, alongside a recent Chromium, on linux (Debian testing). The application is rendering with WebGPU with a Vulkan back-end.
Chromium on the left, Electron on the right:

I found that forcing srgb colour profile worked around it:
rathboma commentedon Feb 12, 2026
I'm seeing this happen again with v39 - anyone else having the same problem?