MCPcopy Create free account
hub / github.com/pollinations/pollinations / hexToRgb

Function hexToRgb

tools/icons/src/render.js:10–18  ·  view source on GitHub ↗
(hex)

Source from the content-addressed store, hash-verified

8}
9
10function hexToRgb(hex) {
11 const m = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
12 if (!m) throw new Error(`Bad hex color: ${hex}`);
13 return {
14 r: Number.parseInt(m[1], 16),
15 g: Number.parseInt(m[2], 16),
16 b: Number.parseInt(m[3], 16),
17 };
18}
19
20/**
21 * Core: a tinted logo sized to `fraction` of the shorter side, centered on a

Callers 2

composeFunction · 0.70
renderOgFunction · 0.70

Calls 1

execMethod · 0.80

Tested by

no test coverage detected