dart-lang/pub-dev

White background for screenshots on dark mode is jarring

Opened this issue · 4 comments

The white background for screenshots (when not expanded) can be jarring. It's perhaps a safe choice as developers may have added screenshots that assume a white background, but they detract from the purpose of dark mode.

Perhaps we could add guidelines that screenshots should expect a light or dark background, or enable a way to specify screenshots for each mode.

Maybe a long shot, but if we could detect that a screenshot is too bright for dark mode, it could be a feedback in pana's analysis. Maybe we could even create a dimmed-down version, or just flag it that it needs dimming through CSS style?

Maybe a long shot, but if we could detect that a screenshot is too bright for dark mode, it could be a feedback in pana's analysis.

Not a bad idea: https://stackoverflow.com/a/38213966/4809566 has a suggestion for detecting brightness from javascript - we would probably do it server-side from pana, but it might not be that difficult...

Yeah, that could be used not only on screenshots, but every image a page may include.

but every image a page may include.

We can probably only do that after we proxy the image data.
Using an external image in the fiddle gets a Uncaught SecurityError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data. at img.onload