Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/landing/ui/field/color/src/internal/ |
Upload File : |
export default function stringToRGB(str: string): {r: number, g: number, b: number, a: number} { const regRGB = /\d{1,3}(\.\d+)?/g; const rgb = str.match(regRGB); const r = rgb[0] ? rgb[0] : null; const g = rgb[1] ? rgb[1] : null; const b = rgb[2] ? rgb[2] : null; const a = rgb[3] ? rgb[3] : 1; if (r === null || g === null || b === null) { return false; } const rgbFormat = 'rgb(' + r + ',' + g + ','+ b + ')'; return { r: r, g: g, b: b, a: a, rgb: rgbFormat, }; }