Repository navigation
Conversation
…forcing color profile as srgb to improve portability
Previous advice of a two element array just flattened and treated the value as another argument, which could be dangerous...
Contributor
Author
wch
reviewed
Jul 2, 2021
|
|
||
|
|
||
| launch_chrome <- function(path = find_chrome(), args = character(0)) { | ||
| launch_chrome <- function(path = find_chrome(), use_srgb_color_profile = TRUE, args = character(0)) { |
Collaborator
There was a problem hiding this comment.
Now that I think about this some more, I don't think we even need to make this optional -- we might as well always set it. (And same for the initialize() method)
wch
reviewed
Jul 2, 2021
| #' screenshotting machines have different color profiles. The downside is | ||
| #' that colors of output may be slightly different than what you see in | ||
| #' your browser. | ||
| #' Equivalent to settings `args = '--force-color-profile="srgb"'`. |
Collaborator
There was a problem hiding this comment.
Please re-wrap comments (Cmd-/ in RStudio) because they'll end up getting re-wrapped at some point in the future, and that will cause spurious changes.
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the same PR as rstudio/webshot2#23 just now applied at the chromote level so it doesn't have to be reimplemented by every wrapping package that will probably want the functionality.
By default, chromote will mirror the color profile of the main monitor of the machine used to take the screenshot. This means that screenshots taken on a laptop plugged into an external monitor will often have subtly different colors than one taken when the laptop is using its built-in monitor. This problem will be even more likely across machines.
To remedy this we set the Chrome headless argument
force-color-profileto"srgb"so the color profile used is always the same across machines/monitors.The
use_srgb_color_profileargument defaults toTRUE. This may break visual tests that use screenshots generated by chromote but I think it's ultimately a better default than the non-portable mirroring of the current monitor's profile.