MCPcopy Index your code
hub / github.com/bernaferrari/FigmaToCode / retrieveTopFill

Function retrieveTopFill

packages/backend/src/common/retrieveFill.ts:6–16  ·  view source on GitHub ↗
(
  fills: ReadonlyArray<Paint> | undefined,
)

Source from the content-addressed store, hash-verified

4 * Retrieve the first visible color that is being used by the layer, in case there are more than one.
5 */
6export const retrieveTopFill = (
7 fills: ReadonlyArray<Paint> | undefined,
8): Paint | undefined => {
9 if (fills && Array.isArray(fills) && fills.length > 0) {
10 // on Figma, the top layer is always at the last position
11 // reverse, then try to find the first layer that is visible, if any.
12 return [...fills].reverse().find((d) => d.visible !== false);
13 }
14
15 return undefined;
16};

Callers 12

flutterContainerFunction · 0.90
tailwindContainerFunction · 0.90
tailwindColorFromFillsFunction · 0.90
htmlColorFromFillsFunction · 0.90
composeContainerFunction · 0.90
composeContainerFunction · 0.90
getTextStylesMethod · 0.90
composeBorderFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected