(into, current)
| 63 | } |
| 64 | |
| 65 | function styleToTokenDataMap(into, current) { |
| 66 | const paints = current.paints.filter( |
| 67 | ({ visible, type }) => visible && type === "SOLID" |
| 68 | ); |
| 69 | if (paints.length === 1) { |
| 70 | const { |
| 71 | blendMode, |
| 72 | color: { r, g, b }, |
| 73 | opacity, |
| 74 | type, |
| 75 | } = paints[0]; |
| 76 | const hex = rgbToHex({ r, g, b }); |
| 77 | if (blendMode === "NORMAL") { |
| 78 | const uniqueId = [hex, opacity].join("-"); |
| 79 | into[uniqueId] = into[uniqueId] || { |
| 80 | color: { r, g, b }, |
| 81 | hex, |
| 82 | opacity, |
| 83 | tokens: [], |
| 84 | }; |
| 85 | into[uniqueId].tokens.push(current.name); |
| 86 | } else { |
| 87 | // do something different i guess |
| 88 | } |
| 89 | } |
| 90 | return into; |
| 91 | } |
| 92 | |
| 93 | function rgbToHex({ r, g, b }) { |
| 94 | const toHex = (value) => { |
nothing calls this directly
no test coverage detected