Skip to content

Fix: Make Image insert screen WebView background transparent - #21823

Open
Ratnesh5 wants to merge 2 commits into
ankidroid:mainfrom
Ratnesh5:fix-image-insert-bg-21820
Open

Fix: Make Image insert screen WebView background transparent#21823
Ratnesh5 wants to merge 2 commits into
ankidroid:mainfrom
Ratnesh5:fix-image-insert-bg-21820

Conversation

@Ratnesh5

Copy link
Copy Markdown
Contributor

Purpose / Description

By default, the image insert screen's WebView renders with a white background. This caused the background to clash with the app's theme and look glaringly out of place, especially in dark mode.

Fixes

Approach

To address this, we need the WebView to have a transparent background so that the underlying app theme's background shows through seamlessly.

  • Overrode setBackgroundColor(color: Int) in SafeWebViewLayout so it applies the color to its internal WebView.
  • Set the multimediaWebView background to Color.TRANSPARENT in MultimediaImageFragment during setupWebView().

Below is the attached screenshot of before and after
WhatsApp Image 2026-09-12 at 02 31 31
Screenshot_20260912_021630

How Has This Been Tested?

  • Built and ran the app on an Android emulator/device.
  • Toggled Dark Mode on.
  • Navigated to the Note Editor and selected the attachment icon to insert an image.
  • Verified that the image preview screen's background is now properly transparent and seamlessly blends in with the dark theme.

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@david-allison david-allison left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be feasible for you to add a @NeedsTest or a screenshot test for this, so we catch future regressions?

Code looks good, thanks!

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Sep 11, 2026
@Ratnesh5

Copy link
Copy Markdown
Contributor Author

Would it be feasible for you to add a @NeedsTest or a screenshot test for this, so we catch future regressions?

Done! Added the @NeedsTest annotations where the background color is set. Thanks for the review!

@david-allison david-allison left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers

@david-allison david-allison added Needs Second Approval Has one approval, one more approval to merge and removed Needs Author Reply Waiting for a reply from the original author Needs Review labels Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Second Approval Has one approval, one more approval to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Image insert screen WebView does not match app background

2 participants