PromoCursed/node_modules/.cache/babel-loader/2fef8a9ff2a40c4e6398d966c244dac5031663db5df690e7987648b73c5a9adc.json
2024-08-20 23:25:37 +04:00

1 line
3.8 KiB
JSON

{"ast":null,"code":"import { TinyColor } from '@ctrl/tinycolor';\nfunction isStableColor(color) {\n return color >= 0 && color <= 255;\n}\nfunction getAlphaColor(frontColor, backgroundColor) {\n const {\n r: fR,\n g: fG,\n b: fB,\n a: originAlpha\n } = new TinyColor(frontColor).toRgb();\n if (originAlpha < 1) {\n return frontColor;\n }\n const {\n r: bR,\n g: bG,\n b: bB\n } = new TinyColor(backgroundColor).toRgb();\n for (let fA = 0.01; fA <= 1; fA += 0.01) {\n const r = Math.round((fR - bR * (1 - fA)) / fA);\n const g = Math.round((fG - bG * (1 - fA)) / fA);\n const b = Math.round((fB - bB * (1 - fA)) / fA);\n if (isStableColor(r) && isStableColor(g) && isStableColor(b)) {\n return new TinyColor({\n r,\n g,\n b,\n a: Math.round(fA * 100) / 100\n }).toRgbString();\n }\n }\n // fallback\n /* istanbul ignore next */\n return new TinyColor({\n r: fR,\n g: fG,\n b: fB,\n a: 1\n }).toRgbString();\n}\nexport default getAlphaColor;","map":{"version":3,"names":["TinyColor","isStableColor","color","getAlphaColor","frontColor","backgroundColor","r","fR","g","fG","b","fB","a","originAlpha","toRgb","bR","bG","bB","fA","Math","round","toRgbString"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/antd/es/theme/util/getAlphaColor.js"],"sourcesContent":["import { TinyColor } from '@ctrl/tinycolor';\nfunction isStableColor(color) {\n return color >= 0 && color <= 255;\n}\nfunction getAlphaColor(frontColor, backgroundColor) {\n const {\n r: fR,\n g: fG,\n b: fB,\n a: originAlpha\n } = new TinyColor(frontColor).toRgb();\n if (originAlpha < 1) {\n return frontColor;\n }\n const {\n r: bR,\n g: bG,\n b: bB\n } = new TinyColor(backgroundColor).toRgb();\n for (let fA = 0.01; fA <= 1; fA += 0.01) {\n const r = Math.round((fR - bR * (1 - fA)) / fA);\n const g = Math.round((fG - bG * (1 - fA)) / fA);\n const b = Math.round((fB - bB * (1 - fA)) / fA);\n if (isStableColor(r) && isStableColor(g) && isStableColor(b)) {\n return new TinyColor({\n r,\n g,\n b,\n a: Math.round(fA * 100) / 100\n }).toRgbString();\n }\n }\n // fallback\n /* istanbul ignore next */\n return new TinyColor({\n r: fR,\n g: fG,\n b: fB,\n a: 1\n }).toRgbString();\n}\nexport default getAlphaColor;"],"mappings":"AAAA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,aAAaA,CAACC,KAAK,EAAE;EAC5B,OAAOA,KAAK,IAAI,CAAC,IAAIA,KAAK,IAAI,GAAG;AACnC;AACA,SAASC,aAAaA,CAACC,UAAU,EAAEC,eAAe,EAAE;EAClD,MAAM;IACJC,CAAC,EAAEC,EAAE;IACLC,CAAC,EAAEC,EAAE;IACLC,CAAC,EAAEC,EAAE;IACLC,CAAC,EAAEC;EACL,CAAC,GAAG,IAAIb,SAAS,CAACI,UAAU,CAAC,CAACU,KAAK,CAAC,CAAC;EACrC,IAAID,WAAW,GAAG,CAAC,EAAE;IACnB,OAAOT,UAAU;EACnB;EACA,MAAM;IACJE,CAAC,EAAES,EAAE;IACLP,CAAC,EAAEQ,EAAE;IACLN,CAAC,EAAEO;EACL,CAAC,GAAG,IAAIjB,SAAS,CAACK,eAAe,CAAC,CAACS,KAAK,CAAC,CAAC;EAC1C,KAAK,IAAII,EAAE,GAAG,IAAI,EAAEA,EAAE,IAAI,CAAC,EAAEA,EAAE,IAAI,IAAI,EAAE;IACvC,MAAMZ,CAAC,GAAGa,IAAI,CAACC,KAAK,CAAC,CAACb,EAAE,GAAGQ,EAAE,IAAI,CAAC,GAAGG,EAAE,CAAC,IAAIA,EAAE,CAAC;IAC/C,MAAMV,CAAC,GAAGW,IAAI,CAACC,KAAK,CAAC,CAACX,EAAE,GAAGO,EAAE,IAAI,CAAC,GAAGE,EAAE,CAAC,IAAIA,EAAE,CAAC;IAC/C,MAAMR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