{"ast":null,"code":"import { inputToRGB, rgbToHex, rgbToHsv } from '@ctrl/tinycolor';\nvar hueStep = 2; // 色相阶梯\nvar saturationStep = 0.16; // 饱和度阶梯,浅色部分\nvar saturationStep2 = 0.05; // 饱和度阶梯,深色部分\nvar brightnessStep1 = 0.05; // 亮度阶梯,浅色部分\nvar brightnessStep2 = 0.15; // 亮度阶梯,深色部分\nvar lightColorCount = 5; // 浅色数量,主色上\nvar darkColorCount = 4; // 深色数量,主色下\n// 暗色主题颜色映射关系表\nvar darkColorMap = [{\n index: 7,\n opacity: 0.15\n}, {\n index: 6,\n opacity: 0.25\n}, {\n index: 5,\n opacity: 0.3\n}, {\n index: 5,\n opacity: 0.45\n}, {\n index: 5,\n opacity: 0.65\n}, {\n index: 5,\n opacity: 0.85\n}, {\n index: 4,\n opacity: 0.9\n}, {\n index: 3,\n opacity: 0.95\n}, {\n index: 2,\n opacity: 0.97\n}, {\n index: 1,\n opacity: 0.98\n}];\n// Wrapper function ported from TinyColor.prototype.toHsv\n// Keep it here because of `hsv.h * 360`\nfunction toHsv(_ref) {\n var r = _ref.r,\n g = _ref.g,\n b = _ref.b;\n var hsv = rgbToHsv(r, g, b);\n return {\n h: hsv.h * 360,\n s: hsv.s,\n v: hsv.v\n };\n}\n\n// Wrapper function ported from TinyColor.prototype.toHexString\n// Keep it here because of the prefix `#`\nfunction toHex(_ref2) {\n var r = _ref2.r,\n g = _ref2.g,\n b = _ref2.b;\n return \"#\".concat(rgbToHex(r, g, b, false));\n}\n\n// Wrapper function ported from TinyColor.prototype.mix, not treeshakable.\n// Amount in range [0, 1]\n// Assume color1 & color2 has no alpha, since the following src code did so.\nfunction mix(rgb1, rgb2, amount) {\n var p = amount / 100;\n var rgb = {\n r: (rgb2.r - rgb1.r) * p + rgb1.r,\n g: (rgb2.g - rgb1.g) * p + rgb1.g,\n b: (rgb2.b - rgb1.b) * p + rgb1.b\n };\n return rgb;\n}\nfunction getHue(hsv, i, light) {\n var hue;\n // 根据色相不同,色相转向不同\n if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {\n hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;\n } else {\n hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;\n }\n if (hue < 0) {\n hue += 360;\n } else if (hue >= 360) {\n hue -= 360;\n }\n return hue;\n}\nfunction getSaturation(hsv, i, light) {\n // grey color don't change saturation\n if (hsv.h === 0 && hsv.s === 0) {\n return hsv.s;\n }\n var saturation;\n if (light) {\n saturation = hsv.s - saturationStep * i;\n } else if (i === darkColorCount) {\n saturation = hsv.s + saturationStep;\n } else {\n saturation = hsv.s + saturationStep2 * i;\n }\n // 边界值修正\n if (saturation > 1) {\n saturation = 1;\n }\n // 第一格的 s 限制在 0.06-0.1 之间\n if (light && i === lightColorCount && saturation > 0.1) {\n saturation = 0.1;\n }\n if (saturation < 0.06) {\n saturation = 0.06;\n }\n return Number(saturation.toFixed(2));\n}\nfunction getValue(hsv, i, light) {\n var value;\n if (light) {\n value = hsv.v + brightnessStep1 * i;\n } else {\n value = hsv.v - brightnessStep2 * i;\n }\n if (value > 1) {\n value = 1;\n }\n return Number(value.toFixed(2));\n}\nexport default function generate(color) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var patterns = [];\n var pColor = inputToRGB(color);\n for (var i = lightColorCount; i > 0; i -= 1) {\n var hsv = toHsv(pColor);\n var colorString = toHex(inputToRGB({\n h: getHue(hsv, i, true),\n s: getSaturation(hsv, i, true),\n v: getValue(hsv, i, true)\n }));\n patterns.push(colorString);\n }\n patterns.push(toHex(pColor));\n for (var _i = 1; _i <= darkColorCount; _i += 1) {\n var _hsv = toHsv(pColor);\n var _colorString = toHex(inputToRGB({\n h: getHue(_hsv, _i),\n s: getSaturation(_hsv, _i),\n v: getValue(_hsv, _i)\n }));\n patterns.push(_colorString);\n }\n\n // dark theme patterns\n if (opts.theme === 'dark') {\n return darkColorMap.map(function (_ref3) {\n var index = _ref3.index,\n opacity = _ref3.opacity;\n var darkColorString = toHex(mix(inputToRGB(opts.backgroundColor || '#141414'), inputToRGB(patterns[index]), opacity * 100));\n return darkColorString;\n });\n }\n return patterns;\n}","map":{"version":3,"names":["inputToRGB","rgbToHex","rgbToHsv","hueStep","saturationStep","saturationStep2","brightnessStep1","brightnessStep2","lightColorCount","darkColorCount","darkColorMap","index","opacity","toHsv","_ref","r","g","b","hsv","h","s","v","toHex","_ref2","concat","mix","rgb1","rgb2","amount","p","rgb","getHue","i","light","hue","Math","round","getSaturation","saturation","Number","toFixed","getValue","value","generate","color","opts","arguments","length","undefined","patterns","pColor","colorString","push","_i","_hsv","_colorString","theme","map","_ref3","darkColorString","backgroundColor"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/@ant-design/colors/es/generate.js"],"sourcesContent":["import { inputToRGB, rgbToHex, rgbToHsv } from '@ctrl/tinycolor';\nvar hueStep = 2; // 色相阶梯\nvar saturationStep = 0.16; // 饱和度阶梯,浅色部分\nvar saturationStep2 = 0.05; // 饱和度阶梯,深色部分\nvar brightnessStep1 = 0.05; // 亮度阶梯,浅色部分\nvar brightnessStep2 = 0.15; // 亮度阶梯,深色部分\nvar lightColorCount = 5; // 浅色数量,主色上\nvar darkColorCount = 4; // 深色数量,主色下\n// 暗色主题颜色映射关系表\nvar darkColorMap = [{\n index: 7,\n opacity: 0.15\n}, {\n index: 6,\n opacity: 0.25\n}, {\n index: 5,\n opacity: 0.3\n}, {\n index: 5,\n opacity: 0.45\n}, {\n index: 5,\n opacity: 0.65\n}, {\n index: 5,\n opacity: 0.85\n}, {\n index: 4,\n opacity: 0.9\n}, {\n index: 3,\n opacity: 0.95\n}, {\n index: 2,\n opacity: 0.97\n}, {\n index: 1,\n opacity: 0.98\n}];\n// Wrapper function ported from TinyColor.prototype.toHsv\n// Keep it here because of `hsv.h * 360`\nfunction toHsv(_ref) {\n var r = _ref.r,\n g = _ref.g,\n b = _ref.b;\n var hsv = rgbToHsv(r, g, b);\n return {\n h: hsv.h * 360,\n s: hsv.s,\n v: hsv.v\n };\n}\n\n// Wrapper function ported from TinyColor.prototype.toHexString\n// Keep it here because of the prefix `#`\nfunction toHex(_ref2) {\n var r = _ref2.r,\n g = _ref2.g,\n b = _ref2.b;\n return \"#\".concat(rgbToHex(r, g, b, false));\n}\n\n// Wrapper function ported from TinyColor.prototype.mix, not treeshakable.\n// Amount in range [0, 1]\n// Assume color1 & color2 has no alpha, since the following src code did so.\nfunction mix(rgb1, rgb2, amount) {\n var p = amount / 100;\n var rgb = {\n r: (rgb2.r - rgb1.r) * p + rgb1.r,\n g: (rgb2.g - rgb1.g) * p + rgb1.g,\n b: (rgb2.b - rgb1.b) * p + rgb1.b\n };\n return rgb;\n}\nfunction getHue(hsv, i, light) {\n var hue;\n // 根据色相不同,色相转向不同\n if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {\n hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;\n } else {\n hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;\n }\n if (hue < 0) {\n hue += 360;\n } else if (hue >= 360) {\n hue -= 360;\n }\n return hue;\n}\nfunction getSaturation(hsv, i, light) {\n // grey color don't change saturation\n if (hsv.h === 0 && hsv.s === 0) {\n return hsv.s;\n }\n var saturation;\n if (light) {\n saturation = hsv.s - saturationStep * i;\n } else if (i === darkColorCount) {\n saturation = hsv.s + saturationStep;\n } else {\n saturation = hsv.s + saturationStep2 * i;\n }\n // 边界值修正\n if (saturation > 1) {\n saturation = 1;\n }\n // 第一格的 s 限制在 0.06-0.1 之间\n if (light && i === lightColorCount && saturation > 0.1) {\n saturation = 0.1;\n }\n if (saturation < 0.06) {\n saturation = 0.06;\n }\n return Number(saturation.toFixed(2));\n}\nfunction getValue(hsv, i, light) {\n var value;\n if (light) {\n value = hsv.v + brightnessStep1 * i;\n } else {\n value = hsv.v - brightnessStep2 * i;\n }\n if (value > 1) {\n value = 1;\n }\n return Number(value.toFixed(2));\n}\nexport default function generate(color) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var patterns = [];\n var pColor = inputToRGB(color);\n for (var i = lightColorCount; i > 0; i -= 1) {\n var hsv = toHsv(pColor);\n var colorString = toHex(inputToRGB({\n h: getHue(hsv, i, true),\n s: getSaturation(hsv, i, true),\n v: getValue(hsv, i, true)\n }));\n patterns.push(colorString);\n }\n patterns.push(toHex(pColor));\n for (var _i = 1; _i <= darkColorCount; _i += 1) {\n var _hsv = toHsv(pColor);\n var _colorString = toHex(inputToRGB({\n h: getHue(_hsv, _i),\n s: getSaturation(_hsv, _i),\n v: getValue(_hsv, _i)\n }));\n patterns.push(_colorString);\n }\n\n // dark theme patterns\n if (opts.theme === 'dark') {\n return darkColorMap.map(function (_ref3) {\n var index = _ref3.index,\n opacity = _ref3.opacity;\n var darkColorString = toHex(mix(inputToRGB(opts.backgroundColor || '#141414'), inputToRGB(patterns[index]), opacity * 100));\n return darkColorString;\n });\n }\n return patterns;\n}"],"mappings":"AAAA,SAASA,UAAU,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,iBAAiB;AAChE,IAAIC,OAAO,GAAG,CAAC,CAAC,CAAC;AACjB,IAAIC,cAAc,GAAG,IAAI,CAAC,CAAC;AAC3B,IAAIC,eAAe,GAAG,IAAI,CAAC,CAAC;AAC5B,IAAIC,eAAe,GAAG,IAAI,CAAC,CAAC;AAC5B,IAAIC,eAAe,GAAG,IAAI,CAAC,CAAC;AAC5B,IAAIC,eAAe,GAAG,CAAC,CAAC,CAAC;AACzB,IAAIC,cAAc,GAAG,CAAC,CAAC,CAAC;AACxB;AACA,IAAIC,YAAY,GAAG,CAAC;EAClBC,KAAK,EAAE,CAAC;EACRC,OAAO,EAAE;AACX,CAAC,EAAE;EACDD,KAAK,EAAE,CAAC;EACRC,OAAO,EAAE;AACX,CAAC,EAAE;EACDD,KAAK,EAAE,CAAC;EACRC,OAAO,EA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