(value: string)
| 264 | }; |
| 265 | |
| 266 | const parseColor = (value: string) => { |
| 267 | const up = value.toUpperCase().replace(/[^0-9A-F]/g, ""); |
| 268 | |
| 269 | if (up.length !== 3 && up.length !== 6) { |
| 270 | log.error(`"${value}" value is not a valid hexadecimal color.`); |
| 271 | process.exit(1); |
| 272 | } |
| 273 | |
| 274 | const hex = |
| 275 | up.length === 3 |
| 276 | ? "#" + up[0] + up[0] + up[1] + up[1] + up[2] + up[2] |
| 277 | : "#" + up; |
| 278 | |
| 279 | const rgb = { |
| 280 | R: (Number.parseInt("" + hex[1] + hex[2], 16) / 255).toPrecision(15), |
| 281 | G: (Number.parseInt("" + hex[3] + hex[4], 16) / 255).toPrecision(15), |
| 282 | B: (Number.parseInt("" + hex[5] + hex[6], 16) / 255).toPrecision(15), |
| 283 | }; |
| 284 | |
| 285 | return { hex: hex.toLowerCase(), rgb }; |
| 286 | }; |
| 287 | |
| 288 | export const transformProps = async ( |
| 289 | rootPath: string, |
no outgoing calls
no test coverage detected
searching dependent graphs…