wailsapp/wails · error
SetBkColor failed
Error message
SetBkColor failed
What it means
Error "SetBkColor failed" thrown in wailsapp/wails.
Source
Thrown at v3/pkg/w32/gdi32.go:428
func SetTextColor(hdc HDC, crColor COLORREF) COLORREF {
ret, _, _ := procSetTextColor.Call(
uintptr(hdc),
uintptr(crColor))
if ret == CLR_INVALID {
panic("SetTextColor failed")
}
return COLORREF(ret)
}
func SetBkColor(hdc HDC, crColor COLORREF) COLORREF {
ret, _, _ := procSetBkColor.Call(
uintptr(hdc),
uintptr(crColor))
if ret == CLR_INVALID {
panic("SetBkColor failed")
}
return COLORREF(ret)
}
func StartDoc(hdc HDC, lpdi *DOCINFO) int {
ret, _, _ := procStartDoc.Call(
uintptr(hdc),
uintptr(unsafe.Pointer(lpdi)))
return int(ret)
}
func StartPage(hdc HDC) int {
ret, _, _ := procStartPage.Call(
uintptr(hdc))
return int(ret)View on GitHub (pinned to 0e754b1b40)
Solutions
- Pass a valid HDC that supports text output; SetBkColor fails on invalid or deleted device contexts.
- Ensure the COLORREF value is a valid RGB value created with the RGB macro; an invalid color value causes the call to return CLR_INVALID.
When it happens
Trigger: Occurs when SetBkColor returns CLR_INVALID, typically due to an invalid device context handle or an invalid color value.
Common situations: See trigger scenarios.
AI-assisted analysis of wailsapp/wails@0e754b1b40 (2026-08-15).
Data as JSON: /api/errors/3f559fce6a743ecb.
Report an issue: GitHub.