From b652e61e2c1916d3b6144704b82cbbf7dab1c500 Mon Sep 17 00:00:00 2001 From: Brad Harker Date: Fri, 21 Nov 2025 22:58:11 -0500 Subject: [PATCH] Fix background color alpha on linux (#4722) * Fix background color alpha on linux * Add CHANGELOG entry * Apply suggestion from @coderabbitai[bot] Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: Lea Anthony Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- v3/UNRELEASED_CHANGELOG.md | 2 ++ v3/pkg/application/linux_cgo.go | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/v3/UNRELEASED_CHANGELOG.md b/v3/UNRELEASED_CHANGELOG.md index 8e4648038..bb8e5490d 100644 --- a/v3/UNRELEASED_CHANGELOG.md +++ b/v3/UNRELEASED_CHANGELOG.md @@ -24,6 +24,8 @@ After processing, the content will be moved to the main changelog and this file ## Fixed +- Resolve alpha value being ignored in `application.WebviewWindowOptions.BackgroundColour` on Linux ([#4722](https://github.com/wailsapp/wails/pull/4722), @BradHacker) + ## Deprecated diff --git a/v3/pkg/application/linux_cgo.go b/v3/pkg/application/linux_cgo.go index 3fbb543c6..c30d7113f 100644 --- a/v3/pkg/application/linux_cgo.go +++ b/v3/pkg/application/linux_cgo.go @@ -1190,7 +1190,6 @@ func (w *linuxWebviewWindow) setBackgroundColour(colour RGBA) { rgba := C.GdkRGBA{C.double(colour.Red) / 255.0, C.double(colour.Green) / 255.0, C.double(colour.Blue) / 255.0, C.double(colour.Alpha) / 255.0} C.webkit_web_view_set_background_color((*C.WebKitWebView)(w.webview), &rgba) - colour.Alpha = 255 cssStr := C.CString(fmt.Sprintf("#webview-box {background-color: rgba(%d, %d, %d, %1.1f);}", colour.Red, colour.Green, colour.Blue, float32(colour.Alpha)/255.0)) provider := C.gtk_css_provider_new() C.gtk_style_context_add_provider(