{"ScriptPreparationCode":null,"TestCases":[{"Name":"old","Code":"function hueToRGB(h, s, l) {\r\n const c = s * (1 - Math.abs(2 * l - 1));\r\n const x = c * (1 - Math.abs((h / 60) % 2 - 1));\r\n const m = l - c / 2;\r\n\r\n let r = 0;\r\n let g = 0;\r\n let b = 0;\r\n\r\n if (0 \u003C= h \u0026\u0026 h \u003C 60) {\r\n r = c;\r\n g = x;\r\n b = 0;\r\n } else if (60 \u003C= h \u0026\u0026 h \u003C 120) {\r\n r = x;\r\n g = c;\r\n b = 0;\r\n } else if (120 \u003C= h \u0026\u0026 h \u003C 180) {\r\n r = 0;\r\n g = c;\r\n b = x;\r\n } else if (180 \u003C= h \u0026\u0026 h \u003C 240) {\r\n r = 0;\r\n g = x;\r\n b = c;\r\n } else if (240 \u003C= h \u0026\u0026 h \u003C 300) {\r\n r = x;\r\n g = 0;\r\n b = c;\r\n } else if (300 \u003C= h \u0026\u0026 h \u003C 360) {\r\n r = c;\r\n g = 0;\r\n b = x;\r\n }\r\n\r\n return [Math.round((r \u002B m) * 255), Math.round((g \u002B m) * 255), Math.round((b \u002B m) * 255)];\r\n}\r\n\r\n\r\nfunction textToHtmlRainbow(str) {\r\n const frequency = 360 / str.length;\r\n\r\n return Array.from(str).map((c, i) =\u003E {\r\n const [r, g, b] = hueToRGB(i * frequency, 1.0, 0.5);\r\n return \u0027\u003Cfont color=\u0022#\u0027 \u002B\r\n r.toString(16).padStart(2, \u00220\u0022) \u002B\r\n g.toString(16).padStart(2, \u00220\u0022) \u002B\r\n b.toString(16).padStart(2, \u00220\u0022) \u002B\r\n \u0027\u0022\u003E\u0027 \u002B c \u002B \u0027\u003C/font\u003E\u0027;\r\n }).join(\u0022\u0022);\r\n}\r\n\r\ntextToHtmlRainbow(\u0022Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor inci didunt ut labore\u0022);","IsDeferred":false},{"Name":"new","Code":"function hueToRGB(h, s, l) {\r\n const c = s * (1 - Math.abs(2 * l - 1));\r\n const x = c * (1 - Math.abs((h / 60) % 2 - 1));\r\n const m = l - c / 2;\r\n\r\n let r = 0;\r\n let g = 0;\r\n let b = 0;\r\n\r\n function setRGB(a, b, c){\r\n r = a;\r\n g = b;\r\n b = c;\r\n }\r\n\r\n switch (true) {\r\n case h \u003C 60: setRGB(c, x, 0); break;\r\n case h \u003C 120: setRGB(x, c, 0); break;\r\n case h \u003C 180: setRGB(0, c, x); break;\r\n case h \u003C 240: setRGB(0, x, c); break;\r\n case h \u003C 300: setRGB(x, 0, c); break;\r\n default: setRGB(c, 0, x); break;\r\n }\r\n\r\n return [Math.round((r \u002B m) * 255), Math.round((g \u002B m) * 255), Math.round((b \u002B m) * 255)];\r\n}\r\n\r\nfunction textToHtmlRainbow(str) {\r\n\tconst s = str.replace(/ /g, \u0027\u0027);\r\n const frequency = 360 / s.length;\r\n let i = 0;\r\n\r\n return Array.from(str).map(c =\u003E {\r\n \tif (c === \u0027 \u0027) return \u0027 \u0027;\r\n const [r, g, b] = hueToRGB(i * frequency, 1.0, 0.5);\r\n i\u002B\u002B;\r\n return \u0027\u003Cfont color=\u0022#\u0027 \u002B\r\n r.toString(16).padStart(2, \u00220\u0022) \u002B\r\n g.toString(16).padStart(2, \u00220\u0022) \u002B\r\n b.toString(16).padStart(2, \u00220\u0022) \u002B\r\n \u0027\u0022\u003E\u0027 \u002B c \u002B \u0027\u003C/font\u003E\u0027;\r\n }).join(\u0022\u0022);\r\n}\r\n\r\ntextToHtmlRainbow(\u0022Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor inci didunt ut labore\u0022);","IsDeferred":false}]}