MCPcopy Index your code
hub / github.com/diffgram/diffgram / parseGradient

Function parseGradient

frontend/src/utils/colorUtils.js:280–286  ·  view source on GitHub ↗
(gradient, colors, currentTheme)

Source from the content-addressed store, hash-verified

278}
279
280function parseGradient(gradient, colors, currentTheme) {
281 return gradient.replace(/([a-z]+(\s[a-z]+-[1-5])?)(?=$|,)/gi, function (x) {
282 return classToHex(x, colors, currentTheme) || x;
283 }).replace(/(rgba\()#[0-9a-f]+(?=,)/gi, function (x) {
284 return 'rgba(' + Object.values(HexToRGBA(parseHex(x.replace(/rgba\(/, '')))).slice(0, 3).join(',');
285 });
286}
287
288function RGBtoInt(rgba) {
289 return (rgba.r << 16) + (rgba.g << 8) + rgba.b;

Callers

nothing calls this directly

Calls 4

classToHexFunction · 0.85
HexToRGBAFunction · 0.85
parseHexFunction · 0.85
replaceMethod · 0.80

Tested by

no test coverage detected