MCPcopy
hub / github.com/vitejs/vite / rgbToHex

Function rgbToHex

playground/test-utils.ts:83–95  ·  view source on GitHub ↗
(rgb: string)

Source from the content-addressed store, hash-verified

81}
82
83function rgbToHex(rgb: string): string | undefined {
84 const match = rgb.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/)
85 if (match) {
86 const [_, rs, gs, bs] = match
87 return (
88 '#' +
89 componentToHex(parseInt(rs, 10)) +
90 componentToHex(parseInt(gs, 10)) +
91 componentToHex(parseInt(bs, 10))
92 )
93 }
94 return undefined
95}
96
97async function toEl(
98 el: string | ElementHandle | Locator,

Callers 2

getColorFunction · 0.85
getBgColorFunction · 0.85

Calls 1

componentToHexFunction · 0.85

Tested by

no test coverage detected