MCPcopy
hub / github.com/sonofmagic/weapp-tailwindcss / hexToRgb

Function hexToRgb

packages-runtime/typography/src/styles.js:21–28  ·  view source on GitHub ↗
(hex)

Source from the content-addressed store, hash-verified

19const HEX_CHAR_DOUBLE_RE = /./g
20
21function hexToRgb(hex) {
22 hex = hex.replace('#', '')
23 hex = hex.length === 3 ? hex.replaceAll(HEX_CHAR_DOUBLE_RE, '$&$&') : hex
24 const r = Number.parseInt(hex.slice(0, 2), 16)
25 const g = Number.parseInt(hex.slice(2, 4), 16)
26 const b = Number.parseInt(hex.slice(4, 6), 16)
27 return `${r} ${g} ${b}`
28}
29
30const defaultModifiers = {
31 'sm': {

Callers 1

styles.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected