MCPcopy
hub / github.com/figma/plugin-samples / toHex

Function toHex

styles-to-variables/code.js:94–97  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

92
93function rgbToHex({ r, g, b }) {
94 const toHex = (value) => {
95 const hex = Math.round(value * 255).toString(16);
96 return hex.length === 1 ? "0" + hex : hex;
97 };
98
99 const hex = [toHex(r), toHex(g), toHex(b)].join("");
100 return `#${hex}`;

Callers 1

rgbToHexFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected