{"record":{"id":"c510eca810989562","repo":"File-New-Project/EarTrumpet","slug":"brushvalueparser-value","errorCode":null,"errorMessage":"BrushValueParser: '{value}'","messagePattern":"BrushValueParser: '(.+?)'","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"EarTrumpet/UI/Themes/BrushValueParser.cs","lineNumber":100,"sourceCode":"                    if (map.ContainsKey(\"\"))\r\n                    {\r\n                        colorName = map[\"\"];\r\n                    }\r\n                    else if (map.ContainsKey(\"HighContrast\"))\r\n                    {\r\n                        colorName = map[\"HighContrast\"];\r\n                    }\r\n                    else if (map.ContainsKey(\"Theme\"))\r\n                    {\r\n                        colorName = map[\"Theme\"].Replace(\"{Theme}\", \"Light\");\r\n                    }\r\n                    else if (map.ContainsKey(\"Light\"))\r\n                    {\r\n                        colorName = map[\"Light\"];\r\n                    }\r\n                    else\r\n                    {\r\n                        throw new NotImplementedException($\"BrushValueParser: '{value}'\");\r\n                    }\r\n                }\r\n                else\r\n                {\r\n                    if (map.ContainsKey(\"\"))\r\n                    {\r\n                        colorName = map[\"\"];\r\n                    }\r\n                    else if (map.ContainsKey(\"Theme\"))\r\n                    {\r\n                        colorName = map[\"Theme\"].Replace(\"{Theme}\", isLight ? \"Light\" : \"Dark\");\r\n                    }\r\n                    else if (map.ContainsKey(\"Light\") && isLight)\r\n                    {\r\n                        colorName = map[\"Light\"];\r\n                    }\r\n                    else if (map.ContainsKey(\"Dark\") && !isLight)\r\n                    {\r","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/File-New-Project/EarTrumpet/blob/aa894e51c22f5f9a939b31b224c4d2d3e163416e/EarTrumpet/UI/Themes/BrushValueParser.cs#L82-L118","documentation":"BrushValueParser.Parse resolves a WPF theme brush from a compact markup string (e.g. \"Theme=Transparent\", \"Flyout:Theme=Transparent, HighContrast=Window\"). In HighContrast mode it tries, in order, the keys \"\" (default), \"HighContrast\", \"Theme\", \"Light\"; if none of those keys is present in the chosen scope map it throws NotImplementedException. The throw means the theme value provides no usable color for the active HighContrast state.","triggerScenarios":"SystemParameters.HighContrast is true and a theme brush value contains only a \"Dark=...\" entry (or a scope that lacks \"\"/\"HighContrast\"/\"Theme\"/\"Light\"), so the high-contrast branch falls through to the throw.","commonSituations":"A theme author added a new brush with only a Dark variant; a scoped value (\"Header:Dark=...\") was added without a high-contrast fallback; high-contrast testing was skipped.","solutions":["Add a default \"\" entry or a \"HighContrast=\" entry to the offending brush value so the high-contrast branch resolves.","Provide a \"Theme=\" entry (it is substituted as Light in HC) if you want one value to cover HC.","Audit all BrushValueParser markup strings for coverage across \"\", HighContrast, Theme, Light, Dark.","Test theme loading with High Contrast enabled."],"exampleFix":"// before (XAML/theme markup): \"Header:Dark=AccentColor\"\n// after: \"Header:Dark=AccentColor, HighContrast=WindowColor\"\n//   or simply: \"AccentColor\"  (default key covers all modes)","handlingStrategy":"validation","validationCode":"// validate a brush value covers high contrast before parsing\nbool CoversHighContrast(Dictionary<string,string> map)\n    => map.ContainsKey(\"\") || map.ContainsKey(\"HighContrast\") || map.ContainsKey(\"Theme\") || map.ContainsKey(\"Light\");","typeGuard":null,"tryCatchPattern":"try { return BrushValueParser.Parse(element, value); } catch (Exception ex) { Trace.WriteLine($\"{ex.Message} inner={ex.InnerException?.Message}\"); return FallbackBrush; }","preventionTips":["Always provide a default \"\" or Theme key for each brush so all modes resolve.","Test theme loading with High Contrast on.","CI: lint theme markup to require a high-contrast-covering key per scope."],"tags":["theme","brush","high-contrast","wpf","markup","eartrumpet-ui"],"backgroundTag":null,"analyzedSha":"aa894e51c22f5f9a939b31b224c4d2d3e163416e","analyzedAt":"2026-08-13T18:51:30.564Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}