Repository navigation
[v3] Fix SetBackgroundColour on Windows - #4492
Conversation
Update Chromium window color on calls to SetBackgroundColour.
WalkthroughConsolidates Windows background color logic into setBackgroundColour, updates run() to call it and conditionally apply backdrop for translucent windows. Updates changelog with an unreleased entry, bumps version to v3.0.0-alpha.23, and revises release notes to include a single Windows background fix under “Fixed.” Changes
Sequence Diagram(s)sequenceDiagram
participant App
participant WinWindow
participant NativeWin
participant Chromium
App->>WinWindow: run()
WinWindow->>WinWindow: setBackgroundColour(RGBA, BackgroundType)
alt BackgroundTypeSolid
WinWindow->>NativeWin: SetWindowBackground(RGBA)
WinWindow->>Chromium: SetBackgroundColor(RGBA)
else Transparent/Translucent
WinWindow->>Chromium: SetBackgroundColor(0,0,0,0)
end
alt BackgroundTypeTranslucent
WinWindow->>NativeWin: setBackdropType(parentOptions.backdrop)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15–20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
v3/pkg/application/webview_window_windows.go (1)
2059-2065: Remove redundant global Chromium background call in setupChromium()The instance method
windowsWebviewWindow.setBackgroundColouralready invokesw.chromium.SetBackgroundColourfor both solid and transparent/translucent cases. The extra global call immediately afterward is therefore unnecessary and risks a brief override/flicker.Locations to update:
- v3/pkg/application/webview_window_windows.go @ lines 2058–2064
Proposed diff:
- // Set background colour - w.setBackgroundColour(w.parent.options.BackgroundColour) - chromium.SetBackgroundColour( - w.parent.options.BackgroundColour.Red, - w.parent.options.BackgroundColour.Green, - w.parent.options.BackgroundColour.Blue, - w.parent.options.BackgroundColour.Alpha, - ) + // Set background colour (uses single source of truth) + w.setBackgroundColour(w.parent.options.BackgroundColour)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
v3/pkg/application/webview_window_windows.go(2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: APshenkin
PR: wailsapp/wails#4480
File: v2/internal/frontend/desktop/darwin/message.h:17-19
Timestamp: 2025-08-08T09:13:16.884Z
Learning: In Wails v2 bindings origin verification, processBindingMessage intentionally has different signatures across platforms: Darwin includes an isMainFrame bool (WKWebKit provides it), Linux uses two params (message, source) as WebKitGTK doesn’t expose main-frame info there, and Windows handles origin checks in Go via WebView2 sender/args without a C bridge. This divergence is acceptable/expected per maintainer (APshenkin).
📚 Learning: 2024-09-20T23:34:29.841Z
Learnt from: nixpare
PR: wailsapp/wails#3763
File: v3/examples/keybindings/main.go:16-17
Timestamp: 2024-09-20T23:34:29.841Z
Learning: In the codebase, `application.Options.KeyBindings` uses the `application.Window` type, whereas `application.WebviewWindowOptions.KeyBindings` uses `*application.WebviewWindow`. This is intentional and acceptable.
Applied to files:
v3/pkg/application/webview_window_windows.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Run Go Tests v3 (macos-latest, 1.24)
- GitHub Check: Run Go Tests v3 (windows-latest, 1.24)
- GitHub Check: Run Go Tests v3 (ubuntu-latest, 1.24)
- GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (1)
v3/pkg/application/webview_window_windows.go (1)
483-486: Consolidate background handling and only apply backdrop for TranslucentThis aligns run() with the unified logic and avoids applying backdrop effects where they don’t belong. Looks good.
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
v3/release_notes.md (1)
2-2: Nit: format API name as codeWrap the API name in backticks for consistency/readability.
-- Fix SetBackgroundColour on Windows by @PPTGamer in [PR](https://github.com/wailsapp/wails/pull/4492) +- Fix `SetBackgroundColour` on Windows by @PPTGamer in [PR](https://github.com/wailsapp/wails/pull/4492)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
docs/src/content/docs/changelog.mdx(1 hunks)v3/internal/version/version.txt(1 hunks)v3/release-notes.txt(1 hunks)v3/release_notes.md(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- docs/src/content/docs/changelog.mdx
- v3/internal/version/version.txt
- v3/release-notes.txt
🔇 Additional comments (1)
v3/release_notes.md (1)
1-2: LGTM — concise and scoped release noteClear “Fixed” entry with PR link and attribution. Matches the PR scope.
* Fix SetBackgroundColour on Windows Update Chromium window color on calls to SetBackgroundColour. * update changelog * v3.0.0-alpha.23 --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>




Description
The
SetBackgroundColour()function does not work as expected on Windows.In
v3/pkg/application/webview_window_windows.go, setting the background color is accomplished insetupChromium()andrun()by accomplishing two things:w32.SetBackgroundColour.chromium.SetBackgroundColour.However, only the first of these is currently accomplished by
windowsWebviewWindow.SetBackgroundColour, which means that runtime calls toSetBackgroundColourdo not change the chromium window color.Type of change
Please select the option that is relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using
wails doctor.If you checked Linux, please specify the distro and version.
This was tested by inserting a
window.SetBackgroundColour(application.NewRGB(255, 255, 0))call in the timer goroutine in the default project generated bywails3 initTest Configuration
Checklist:
website/src/pages/changelog.mdxwith details of this PRSummary by CodeRabbit
Bug Fixes
Documentation
Chores