{"ScriptPreparationCode":"function addAlpha(color, opacity) {\r\n // coerce values so ti is between 0 and 1.\r\n const _opacity = Math.round(Math.min(Math.max(opacity || 1, 0), 1) * 255);\r\n return color \u002B _opacity.toString(16).toUpperCase();\r\n}\r\n\r\nfunction hex2rgba(hex, alpha = 1) {\r\n const [r, g, b] = hex.match(/\\w\\w/g).map(x =\u003E parseInt(x, 16));\r\n return \u0060rgba(${r},${g},${b},${alpha})\u0060;\r\n}\r\n\r\n","TestCases":[{"Name":"addAlpha","Code":"addAlpha(\u0027FF0000\u0027, 0.5); ","IsDeferred":false},{"Name":"hex2rgba","Code":"hex2rgba(\u0027FF0000\u0027, 0.5); ","IsDeferred":false}]}