MCPcopy Create free account
hub / github.com/bernaferrari/FigmaToCode / htmlOpacity

Function htmlOpacity

packages/backend/src/html/builderImpl/htmlBlend.ts:11–25  ·  view source on GitHub ↗
(
  node: MinimalBlendMixin,
  isJsx: boolean,
)

Source from the content-addressed store, hash-verified

9 * node.opacity is between [0, 1]; output will be [0, 100]
10 */
11export const htmlOpacity = (
12 node: MinimalBlendMixin,
13 isJsx: boolean,
14): string => {
15 // [when testing] node.opacity can be undefined
16 if (node.opacity !== undefined && node.opacity !== 1) {
17 // formatWithJSX is not called here because opacity unit doesn't end in px.
18 if (isJsx) {
19 return `opacity: ${numberToFixedString(node.opacity)}`;
20 } else {
21 return `opacity: ${numberToFixedString(node.opacity)}`;
22 }
23 }
24 return "";
25};
26
27export const htmlBlendMode = (
28 node: MinimalBlendMixin,

Callers 1

blendMethod · 0.90

Calls 1

numberToFixedStringFunction · 0.90

Tested by

no test coverage detected