{"record":{"id":"b670f996191dd659","repo":"slint-ui/slint","slug":"missing-fill-colors-for-solid-color-value","errorCode":null,"errorMessage":"Missing fill colors for solid color value","messagePattern":"Missing fill colors for solid color value","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"tools/figma-inspector/backend/utils/property-parsing.ts","lineNumber":313,"sourceCode":"    return properties.length > 0 ? properties : null;\n}\n\nexport function getBrush(fill: {\n    type: string;\n    opacity?: number; // Allow opacity to be optional\n    color?: { r: number; g: number; b: number };\n    gradientStops?: ReadonlyArray<{\n        color: { r: number; g: number; b: number; a: number };\n        position: number;\n    }>;\n    gradientTransform?: number[][];\n}): string | null {\n    const opacity = fill.opacity ?? 1; // Default to 1 if opacity is undefined\n\n    switch (fill.type) {\n        case \"SOLID\": {\n            if (!fill.color) {\n                console.warn(\"Missing fill colors for solid color value\");\n                return \"\";\n            }\n            return rgbToHex({ ...fill.color, a: opacity });\n        }\n        case \"GRADIENT_LINEAR\": {\n            if (!fill.gradientStops || !fill.gradientTransform) {\n                console.warn(\"Missing gradient stops for linear gradient\");\n                return \"\";\n            }\n            return generateLinearGradient({\n                opacity: opacity,\n                gradientStops: fill.gradientStops,\n                gradientTransform: fill.gradientTransform,\n            });\n        }\n        case \"GRADIENT_RADIAL\": {\n            if (!fill.gradientStops || !fill.gradientTransform) {\n                return \"\";","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/tools/figma-inspector/backend/utils/property-parsing.ts#L295-L331","documentation":"getBrush in the Figma inspector's property parser encountered a SOLID paint that has no color payload. It warns and returns an empty string, meaning the node's brush becomes blank in the generated Slint snippet.","triggerScenarios":"getBrush (or its callers: getBorderWidthAndColor, generateRectangleSnippet, brush, generatePathNodeSnippet, generateTextSnippet) processes a fill of type 'SOLID' where fill.color is undefined/null.","commonSituations":"Figma node with a solid paint whose color failed to resolve (e.g. paint bound to a color variable the plugin couldn't resolve); partial/corrupted REST response for fills; plugin API returning a paint with color omitted.","solutions":["Check whether the SOLID paint is bound to a color variable and resolve it before calling getBrush","Inspect the node's fills in the plugin API and confirm color is present; re-fetch if it was a transient response gap","Treat empty brush as intended only if the paint is genuinely transparent","Fall back to a neutral color explicitly rather than an empty string if a visible fill is required"],"exampleFix":"// before\nif (!fill.color) { console.warn(...); return \"\"; }\n// after\nif (!fill.color) {\n  const viaVar = resolveColorVariable(fill);\n  if (viaVar) return viaVar;\n  console.warn(\"Missing fill colors for solid color value\");\n  return \"transparent\";\n}","handlingStrategy":"validation","validationCode":"const solid = fills.find(f => f.type === \"SOLID\");\nif (solid && !solid.color) throw new Error(\"Solid paint missing color; resolve variable-bound paints first\");","typeGuard":"function hasSolidColor(fill: Paint): fill is SolidPaint & { color: RGBA } {\n  return fill.type === \"SOLID\" && typeof (fill as SolidPaint).color !== \"undefined\";\n}","tryCatchPattern":"try {\n  brush = getBrush(fill);\n} catch (e) {\n  brush = \"transparent\"; // or report to user\n}","preventionTips":["Resolve variable-bound paints to concrete colors before parsing","Validate fills payload shape coming from the plugin/REST API","Return an explicit transparent/neutral brush instead of an empty string"],"tags":["figma","colors","brush"],"backgroundTag":"missing-required-argument","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}