{"record":{"id":"f6ae263289cffe52","repo":"wailsapp/wails","slug":"settextcolor-failed","errorCode":null,"errorMessage":"SetTextColor failed","messagePattern":"SetTextColor failed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/pkg/w32/gdi32.go","lineNumber":416,"sourceCode":"\n\treturn ret != 0\n}\n\nfunc SetStretchBltMode(hdc HDC, iStretchMode int) int {\n\tret, _, _ := procSetStretchBltMode.Call(\n\t\tuintptr(hdc),\n\t\tuintptr(iStretchMode))\n\n\treturn int(ret)\n}\n\nfunc SetTextColor(hdc HDC, crColor COLORREF) COLORREF {\n\tret, _, _ := procSetTextColor.Call(\n\t\tuintptr(hdc),\n\t\tuintptr(crColor))\n\n\tif ret == CLR_INVALID {\n\t\tpanic(\"SetTextColor failed\")\n\t}\n\n\treturn COLORREF(ret)\n}\n\nfunc SetBkColor(hdc HDC, crColor COLORREF) COLORREF {\n\tret, _, _ := procSetBkColor.Call(\n\t\tuintptr(hdc),\n\t\tuintptr(crColor))\n\n\tif ret == CLR_INVALID {\n\t\tpanic(\"SetBkColor failed\")\n\t}\n\n\treturn COLORREF(ret)\n}\n\nfunc StartDoc(hdc HDC, lpdi *DOCINFO) int {","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/wailsapp/wails/blob/0e754b1b40ba9044c2a1460e23b7c3de20fc5cf3/v3/pkg/w32/gdi32.go#L398-L434","documentation":"Error \"SetTextColor failed\" thrown in wailsapp/wails.","triggerScenarios":"Occurs when SetTextColor returns CLR_INVALID, typically due to an invalid device context handle.","commonSituations":"See trigger scenarios.","solutions":["Pass a valid HDC that supports text output; SetTextColor fails on invalid or deleted device contexts.","Ensure the COLORREF value is a valid RGB value; passing CLR_INVALID or an out-of-range constant is treated as an error indicator."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0e754b1b40ba9044c2a1460e23b7c3de20fc5cf3","analyzedAt":"2026-08-15T14:17:36.034Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}