{"record":{"id":"0858c3ab3fca9eb5","repo":"a-b-street/abstreet","slug":"unsupported-color-style","errorCode":null,"errorMessage":"Unsupported color style {:?}","messagePattern":"Unsupported color style (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"widgetry/src/svg.rs","lineNumber":178,"sourceCode":"    let opt = tessellation::StrokeOptions::tolerance(tolerance)\n        .with_line_width(s.width.get() as f32)\n        .with_line_cap(linecap)\n        .with_line_join(linejoin);\n\n    (color, opt)\n}\n\nfn convert_color(paint: &usvg::Paint, opacity: f64) -> Fill {\n    match paint {\n        usvg::Paint::Color(c) => Fill::Color(Color::rgba(\n            c.red as usize,\n            c.green as usize,\n            c.blue as usize,\n            opacity as f32,\n        )),\n        usvg::Paint::LinearGradient(lg) => LinearGradient::new_fill(lg),\n        // No patterns or radial gradiants\n        _ => panic!(\"Unsupported color style {:?}\", paint),\n    }\n}\n","sourceCodeStart":160,"sourceCodeEnd":181,"githubUrl":"https://github.com/a-b-street/abstreet/blob/0964f29315820c91b171b585eb51e300164e9197/widgetry/src/svg.rs#L160-L181","documentation":"convert_color panics when an SVG paint uses a color style widgetry does not support. Fill/stroke paints other than solid RGBA and linear gradients (e.g. radial gradients, patterns) hit the catch-all arm and panic.","triggerScenarios":"Loading an SVG whose fill or stroke is a radialGradient, a pattern reference, a context-paint, or any usvg::Paint variant other than Color and LinearGradient, via load_svg/load_svg_bytes or convert_stroke.","commonSituations":"SVGs exported from design tools (Figma/Illustrator) with radial gradient fills or pattern textures; icons using gradient meshes; auto-generated SVGs with <pattern> backgrounds.","solutions":["Edit the SVG to replace radial gradients/patterns with solid colors or linear gradients.","Pre-rasterize the SVG to PNG and draw it as a texture instead of parsing vectors.","Run the SVG through a flattening tool (e.g. Inkscape) that converts unsupported paints to solid colors."],"exampleFix":"// before\n<radialGradient id=\"g\">...</radialGradient><circle fill=\"url(#g)\"/>\n// after\n<circle fill=\"#4a90d9\"/>","handlingStrategy":"validation","validationCode":"// Reject unsupported paints before loading\nif svg_text.contains(\"radialGradient\") || svg_text.contains(\"<pattern\") {\n    panic!(\"{} uses unsupported paint styles\", path);\n}","typeGuard":null,"tryCatchPattern":"// Pre-convert in a build step; at runtime prefer preprocessing over catch (panic is not catchable without catch_unwind).","preventionTips":["Lint SVG assets in CI for radialGradient/pattern usage","Flatten gradients to solid colors before committing assets","Prefer PNG textures for complex artwork"],"tags":["rust","svg","gradients","unsupported"],"backgroundTag":"unsupported-enum-value","analyzedSha":"0964f29315820c91b171b585eb51e300164e9197","analyzedAt":"2026-09-13T18:02:03.421Z","contentChangedAt":"2026-09-13T18:02:03.421Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}