MCPcopy Index your code
hub / github.com/zoontek/react-native-bootsplash / parseColor

Function parseColor

src/extras/utils.ts:266–286  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

264};
265
266const 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
288export const transformProps = async (
289 rootPath: string,

Callers 1

transformPropsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…