ipink-themejs
Version:
Theme for ui, 根据自定义的颜色值导出一套常用的Map合集, 字号、圆角、边框、字色、背景色、...
2 lines (1 loc) • 28.2 kB
JavaScript
"use strict";function t(t,r){(function(t){return"string"==typeof t&&-1!==t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");const e=function(t){return"string"==typeof t&&-1!==t.indexOf("%")}(t);return t=360===r?t:Math.min(r,Math.max(0,parseFloat(t))),e&&(t=parseInt(String(t*r),10)/100),Math.abs(t-r)<1e-6?1:t=360===r?(t<0?t%r+r:t%r)/parseFloat(String(r)):t%r/parseFloat(String(r))}function r(t){return Math.min(1,Math.max(0,t))}function e(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function o(t){return Number(t)<=1?100*Number(t)+"%":t}function i(t){return 1===t.length?"0"+t:String(t)}function n(r,e,o){r=t(r,255),e=t(e,255),o=t(o,255);const i=Math.max(r,e,o),n=Math.min(r,e,o);let s=0,a=0;const h=(i+n)/2;if(i===n)a=0,s=0;else{const t=i-n;switch(a=h>.5?t/(2-i-n):t/(i+n),i){case r:s=(e-o)/t+(e<o?6:0);break;case e:s=(o-r)/t+2;break;case o:s=(r-e)/t+4}s/=6}return{h:s,s:a,l:h}}function s(t,r,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+6*e*(r-t):e<.5?r:e<2/3?t+(r-t)*(2/3-e)*6:t}function a(r,e,o){r=t(r,255),e=t(e,255),o=t(o,255);const i=Math.max(r,e,o),n=Math.min(r,e,o);let s=0;const a=i,h=i-n,l=0===i?0:h/i;if(i===n)s=0;else{switch(i){case r:s=(e-o)/h+(e<o?6:0);break;case e:s=(o-r)/h+2;break;case o:s=(r-e)/h+4}s/=6}return{h:s,s:l,v:a}}function h(t,r,e,o){const n=[i(Math.round(t).toString(16)),i(Math.round(r).toString(16)),i(Math.round(e).toString(16))];return o&&n[0].startsWith(n[0].charAt(1))&&n[1].startsWith(n[1].charAt(1))&&n[2].startsWith(n[2].charAt(1))?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}function l(t,r,e){let o=1-t/255,i=1-r/255,n=1-e/255,s=Math.min(o,i,n);return 1===s?(o=0,i=0,n=0):(o=(o-s)/(1-s)*100,i=(i-s)/(1-s)*100,n=(n-s)/(1-s)*100),s*=100,{c:Math.round(o),m:Math.round(i),y:Math.round(n),k:Math.round(s)}}function c(t){return g(t)/255}function g(t){return parseInt(t,16)}Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function f(r){let i={r:0,g:0,b:0},n=1,a=null,h=null,l=null,f=!1,d=!1;var b,m,p;return"string"==typeof r&&(r=function(t){if(t=t.trim().toLowerCase(),0===t.length)return!1;let r=!1;if(u[t])t=u[t],r=!0;else if("transparent"===t)return{r:0,g:0,b:0,a:0,format:"name"};let e=y.rgb.exec(t);if(e)return{r:e[1],g:e[2],b:e[3]};if(e=y.rgba.exec(t),e)return{r:e[1],g:e[2],b:e[3],a:e[4]};if(e=y.hsl.exec(t),e)return{h:e[1],s:e[2],l:e[3]};if(e=y.hsla.exec(t),e)return{h:e[1],s:e[2],l:e[3],a:e[4]};if(e=y.hsv.exec(t),e)return{h:e[1],s:e[2],v:e[3]};if(e=y.hsva.exec(t),e)return{h:e[1],s:e[2],v:e[3],a:e[4]};if(e=y.cmyk.exec(t),e)return{c:e[1],m:e[2],y:e[3],k:e[4]};if(e=y.hex8.exec(t),e)return{r:g(e[1]),g:g(e[2]),b:g(e[3]),a:c(e[4]),format:r?"name":"hex8"};if(e=y.hex6.exec(t),e)return{r:g(e[1]),g:g(e[2]),b:g(e[3]),format:r?"name":"hex"};if(e=y.hex4.exec(t),e)return{r:g(e[1]+e[1]),g:g(e[2]+e[2]),b:g(e[3]+e[3]),a:c(e[4]+e[4]),format:r?"name":"hex8"};if(e=y.hex3.exec(t),e)return{r:g(e[1]+e[1]),g:g(e[2]+e[2]),b:g(e[3]+e[3]),format:r?"name":"hex"};return!1}(r)),"object"==typeof r&&(S(r.r)&&S(r.g)&&S(r.b)?(b=r.r,m=r.g,p=r.b,i={r:255*t(b,255),g:255*t(m,255),b:255*t(p,255)},f=!0,d="%"===String(r.r).substr(-1)?"prgb":"rgb"):S(r.h)&&S(r.s)&&S(r.v)?(a=o(r.s),h=o(r.v),i=function(r,e,o){r=6*t(r,360),e=t(e,100),o=t(o,100);const i=Math.floor(r),n=r-i,s=o*(1-e),a=o*(1-n*e),h=o*(1-(1-n)*e),l=i%6;return{r:255*[o,a,s,s,h,o][l],g:255*[h,o,o,a,s,s][l],b:255*[s,s,h,o,o,a][l]}}(r.h,a,h),f=!0,d="hsv"):S(r.h)&&S(r.s)&&S(r.l)?(a=o(r.s),l=o(r.l),i=function(r,e,o){let i,n,a;if(r=t(r,360),e=t(e,100),o=t(o,100),0===e)n=o,a=o,i=o;else{const t=o<.5?o*(1+e):o+e-o*e,h=2*o-t;i=s(h,t,r+1/3),n=s(h,t,r),a=s(h,t,r-1/3)}return{r:255*i,g:255*n,b:255*a}}(r.h,a,l),f=!0,d="hsl"):S(r.c)&&S(r.m)&&S(r.y)&&S(r.k)&&(i=function(t,r,e,o){const i=o/100;return{r:255*(1-t/100)*(1-i),g:255*(1-r/100)*(1-i),b:255*(1-e/100)*(1-i)}}(r.c,r.m,r.y,r.k),f=!0,d="cmyk"),Object.prototype.hasOwnProperty.call(r,"a")&&(n=r.a)),n=e(n),{ok:f,format:r.format||d,r:Math.min(255,Math.max(i.r,0)),g:Math.min(255,Math.max(i.g,0)),b:Math.min(255,Math.max(i.b,0)),a:n}}const d="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",b="[\\s|\\(]+("+d+")[,|\\s]+("+d+")[,|\\s]+("+d+")\\s*\\)?",m="[\\s|\\(]+("+d+")[,|\\s]+("+d+")[,|\\s]+("+d+")[,|\\s]+("+d+")\\s*\\)?",y={CSS_UNIT:new RegExp(d),rgb:new RegExp("rgb"+b),rgba:new RegExp("rgba"+m),hsl:new RegExp("hsl"+b),hsla:new RegExp("hsla"+m),hsv:new RegExp("hsv"+b),hsva:new RegExp("hsva"+m),cmyk:new RegExp("cmyk"+m),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function S(t){return"number"==typeof t?!Number.isNaN(t):y.CSS_UNIT.test(t)}class TinyColor{constructor(t="",r={}){if(t instanceof TinyColor)return t;"number"==typeof t&&(t=function(t){return{r:t>>16,g:(65280&t)>>8,b:255&t}}(t)),this.originalInput=t;const e=f(t);this.originalInput=t,this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this.roundA=Math.round(100*this.a)/100,this.format=r.format??e.format,this.gradientType=r.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=e.ok}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}getBrightness(){const t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3}getLuminance(){const t=this.toRgb();let r,e,o;const i=t.r/255,n=t.g/255,s=t.b/255;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),e=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),o=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*r+.7152*e+.0722*o}getAlpha(){return this.a}setAlpha(t){return this.a=e(t),this.roundA=Math.round(100*this.a)/100,this}isMonochrome(){const{s:t}=this.toHsl();return 0===t}toHsv(){const t=a(this.r,this.g,this.b);return{h:360*t.h,s:t.s,v:t.v,a:this.a}}toHsvString(){const t=a(this.r,this.g,this.b),r=Math.round(360*t.h),e=Math.round(100*t.s),o=Math.round(100*t.v);return 1===this.a?`hsv(${r}, ${e}%, ${o}%)`:`hsva(${r}, ${e}%, ${o}%, ${this.roundA})`}toHsl(){const t=n(this.r,this.g,this.b);return{h:360*t.h,s:t.s,l:t.l,a:this.a}}toHslString(){const t=n(this.r,this.g,this.b),r=Math.round(360*t.h),e=Math.round(100*t.s),o=Math.round(100*t.l);return 1===this.a?`hsl(${r}, ${e}%, ${o}%)`:`hsla(${r}, ${e}%, ${o}%, ${this.roundA})`}toHex(t=!1){return h(this.r,this.g,this.b,t)}toHexString(t=!1){return"#"+this.toHex(t)}toHex8(t=!1){return function(t,r,e,o,n){const s=[i(Math.round(t).toString(16)),i(Math.round(r).toString(16)),i(Math.round(e).toString(16)),i((a=o,Math.round(255*parseFloat(a)).toString(16)))];var a;return n&&s[0].startsWith(s[0].charAt(1))&&s[1].startsWith(s[1].charAt(1))&&s[2].startsWith(s[2].charAt(1))&&s[3].startsWith(s[3].charAt(1))?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}(this.r,this.g,this.b,this.a,t)}toHex8String(t=!1){return"#"+this.toHex8(t)}toHexShortString(t=!1){return 1===this.a?this.toHexString(t):this.toHex8String(t)}toRgb(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}}toRgbString(){const t=Math.round(this.r),r=Math.round(this.g),e=Math.round(this.b);return 1===this.a?`rgb(${t}, ${r}, ${e})`:`rgba(${t}, ${r}, ${e}, ${this.roundA})`}toPercentageRgb(){const r=r=>`${Math.round(100*t(r,255))}%`;return{r:r(this.r),g:r(this.g),b:r(this.b),a:this.a}}toPercentageRgbString(){const r=r=>Math.round(100*t(r,255));return 1===this.a?`rgb(${r(this.r)}%, ${r(this.g)}%, ${r(this.b)}%)`:`rgba(${r(this.r)}%, ${r(this.g)}%, ${r(this.b)}%, ${this.roundA})`}toCmyk(){return{...l(this.r,this.g,this.b)}}toCmykString(){const{c:t,m:r,y:e,k:o}=l(this.r,this.g,this.b);return`cmyk(${t}, ${r}, ${e}, ${o})`}toName(){if(0===this.a)return"transparent";if(this.a<1)return!1;const t="#"+h(this.r,this.g,this.b,!1);for(const[r,e]of Object.entries(u))if(t===e)return r;return!1}toString(t){const r=Boolean(t);t=t??this.format;let e=!1;const o=this.a<1&&this.a>=0;return r||!o||!t.startsWith("hex")&&"name"!==t?("rgb"===t&&(e=this.toRgbString()),"prgb"===t&&(e=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(e=this.toHexString()),"hex3"===t&&(e=this.toHexString(!0)),"hex4"===t&&(e=this.toHex8String(!0)),"hex8"===t&&(e=this.toHex8String()),"name"===t&&(e=this.toName()),"hsl"===t&&(e=this.toHslString()),"hsv"===t&&(e=this.toHsvString()),"cmyk"===t&&(e=this.toCmykString()),e||this.toHexString()):"name"===t&&0===this.a?this.toName():this.toRgbString()}toNumber(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)}clone(){return new TinyColor(this.toString())}lighten(t=10){const e=this.toHsl();return e.l+=t/100,e.l=r(e.l),new TinyColor(e)}brighten(t=10){const r=this.toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(-t/100*255))),r.g=Math.max(0,Math.min(255,r.g-Math.round(-t/100*255))),r.b=Math.max(0,Math.min(255,r.b-Math.round(-t/100*255))),new TinyColor(r)}darken(t=10){const e=this.toHsl();return e.l-=t/100,e.l=r(e.l),new TinyColor(e)}tint(t=10){return this.mix("white",t)}shade(t=10){return this.mix("black",t)}desaturate(t=10){const e=this.toHsl();return e.s-=t/100,e.s=r(e.s),new TinyColor(e)}saturate(t=10){const e=this.toHsl();return e.s+=t/100,e.s=r(e.s),new TinyColor(e)}greyscale(){return this.desaturate(100)}spin(t){const r=this.toHsl(),e=(r.h+t)%360;return r.h=e<0?360+e:e,new TinyColor(r)}mix(t,r=50){const e=this.toRgb(),o=new TinyColor(t).toRgb(),i=r/100,n={r:(o.r-e.r)*i+e.r,g:(o.g-e.g)*i+e.g,b:(o.b-e.b)*i+e.b,a:(o.a-e.a)*i+e.a};return new TinyColor(n)}analogous(t=6,r=30){const e=this.toHsl(),o=360/r,i=[this];for(e.h=(e.h-(o*t>>1)+720)%360;--t;)e.h=(e.h+o)%360,i.push(new TinyColor(e));return i}complement(){const t=this.toHsl();return t.h=(t.h+180)%360,new TinyColor(t)}monochromatic(t=6){const r=this.toHsv(),{h:e}=r,{s:o}=r;let{v:i}=r;const n=[],s=1/t;for(;t--;)n.push(new TinyColor({h:e,s:o,v:i})),i=(i+s)%1;return n}splitcomplement(){const t=this.toHsl(),{h:r}=t;return[this,new TinyColor({h:(r+72)%360,s:t.s,l:t.l}),new TinyColor({h:(r+216)%360,s:t.s,l:t.l})]}onBackground(t){const r=this.toRgb(),e=new TinyColor(t).toRgb(),o=r.a+e.a*(1-r.a);return new TinyColor({r:(r.r*r.a+e.r*e.a*(1-r.a))/o,g:(r.g*r.a+e.g*e.a*(1-r.a))/o,b:(r.b*r.a+e.b*e.a*(1-r.a))/o,a:o})}triad(){return this.polyad(3)}tetrad(){return this.polyad(4)}polyad(t){const r=this.toHsl(),{h:e}=r,o=[this],i=360/t;for(let n=1;n<t;n++)o.push(new TinyColor({h:(e+n*i)%360,s:r.s,l:r.l}));return o}equals(t){const r=new TinyColor(t);return"cmyk"===this.format||"cmyk"===r.format?this.toCmykString()===r.toCmykString():this.toRgbString()===r.toRgbString()}}function p(t){return t>=0&&t<=255}function x(t,r){const{r:e,g:o,b:i,a:n}=new TinyColor(t).toRgb();if(n<1)return t;const{r:s,g:a,b:h}=new TinyColor(r).toRgb();for(let l=.01;l<=1;l+=.01){const t=Math.round((e-s*(1-l))/l),r=Math.round((o-a*(1-l))/l),n=Math.round((i-h*(1-l))/l);if(p(t)&&p(r)&&p(n))return new TinyColor({r:t,g:r,b:n,a:Math.round(100*l)/100}).toRgbString()}return new TinyColor({r:e,g:o,b:i,a:1}).toRgbString()}function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function M(t){var r=function(t,r){if("object"!=v(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var o=e.call(t,r||"default");if("object"!=v(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==v(r)?r:r+""}function w(t,r,e){return(r=M(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}const H=Math.round;function k(t,r){const e=t.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],o=e.map((t=>parseFloat(t)));for(let i=0;i<3;i+=1)o[i]=r(o[i]||0,e[i]||"",i);return e[3]?o[3]=e[3].includes("%")?o[3]/100:o[3]:o[3]=1,o}const T=(t,r,e)=>0===e?t:t/100;function B(t,r){const e=r||255;return t>e?e:t<0?0:t}class FastColor{constructor(t){function r(r){return r[0]in t&&r[1]in t&&r[2]in t}if(w(this,"isValid",!0),w(this,"r",0),w(this,"g",0),w(this,"b",0),w(this,"a",1),w(this,"_h",void 0),w(this,"_s",void 0),w(this,"_l",void 0),w(this,"_v",void 0),w(this,"_max",void 0),w(this,"_min",void 0),w(this,"_brightness",void 0),t)if("string"==typeof t){const e=t.trim();function o(t){return e.startsWith(t)}/^#?[A-F\d]{3,8}$/i.test(e)?this.fromHexString(e):o("rgb")?this.fromRgbString(e):o("hsl")?this.fromHslString(e):(o("hsv")||o("hsb"))&&this.fromHsvString(e)}else if(t instanceof FastColor)this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this._h=t._h,this._s=t._s,this._l=t._l,this._v=t._v;else if(r("rgb"))this.r=B(t.r),this.g=B(t.g),this.b=B(t.b),this.a="number"==typeof t.a?B(t.a,1):1;else if(r("hsl"))this.fromHsl(t);else{if(!r("hsv"))throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(t));this.fromHsv(t)}else;}setR(t){return this._sc("r",t)}setG(t){return this._sc("g",t)}setB(t){return this._sc("b",t)}setA(t){return this._sc("a",t,1)}setHue(t){const r=this.toHsv();return r.h=t,this._c(r)}getLuminance(){function t(t){const r=t/255;return r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4)}return.2126*t(this.r)+.7152*t(this.g)+.0722*t(this.b)}getHue(){if(void 0===this._h){const t=this.getMax()-this.getMin();this._h=0===t?0:H(60*(this.r===this.getMax()?(this.g-this.b)/t+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/t+2:(this.r-this.g)/t+4))}return this._h}getSaturation(){if(void 0===this._s){const t=this.getMax()-this.getMin();this._s=0===t?0:t/this.getMax()}return this._s}getLightness(){return void 0===this._l&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return void 0===this._v&&(this._v=this.getMax()/255),this._v}getBrightness(){return void 0===this._brightness&&(this._brightness=(299*this.r+587*this.g+114*this.b)/1e3),this._brightness}darken(t=10){const r=this.getHue(),e=this.getSaturation();let o=this.getLightness()-t/100;return o<0&&(o=0),this._c({h:r,s:e,l:o,a:this.a})}lighten(t=10){const r=this.getHue(),e=this.getSaturation();let o=this.getLightness()+t/100;return o>1&&(o=1),this._c({h:r,s:e,l:o,a:this.a})}mix(t,r=50){const e=this._c(t),o=r/100,i=t=>(e[t]-this[t])*o+this[t],n={r:H(i("r")),g:H(i("g")),b:H(i("b")),a:H(100*i("a"))/100};return this._c(n)}tint(t=10){return this.mix({r:255,g:255,b:255,a:1},t)}shade(t=10){return this.mix({r:0,g:0,b:0,a:1},t)}onBackground(t){const r=this._c(t),e=this.a+r.a*(1-this.a),o=t=>H((this[t]*this.a+r[t]*r.a*(1-this.a))/e);return this._c({r:o("r"),g:o("g"),b:o("b"),a:e})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(t){return this.r===t.r&&this.g===t.g&&this.b===t.b&&this.a===t.a}clone(){return this._c(this)}toHexString(){let t="#";const r=(this.r||0).toString(16);t+=2===r.length?r:"0"+r;const e=(this.g||0).toString(16);t+=2===e.length?e:"0"+e;const o=(this.b||0).toString(16);if(t+=2===o.length?o:"0"+o,"number"==typeof this.a&&this.a>=0&&this.a<1){const r=H(255*this.a).toString(16);t+=2===r.length?r:"0"+r}return t}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const t=this.getHue(),r=H(100*this.getSaturation()),e=H(100*this.getLightness());return 1!==this.a?`hsla(${t},${r}%,${e}%,${this.a})`:`hsl(${t},${r}%,${e}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return 1!==this.a?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(t,r,e){const o=this.clone();return o[t]=B(r,e),o}_c(t){return new this.constructor(t)}getMax(){return void 0===this._max&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return void 0===this._min&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(t){const r=t.replace("#","");function e(t,e){return parseInt(r[t]+r[e||t],16)}r.length<6?(this.r=e(0),this.g=e(1),this.b=e(2),this.a=r[3]?e(3)/255:1):(this.r=e(0,1),this.g=e(2,3),this.b=e(4,5),this.a=r[6]?e(6,7)/255:1)}fromHsl({h:t,s:r,l:e,a:o}){if(this._h=t%360,this._s=r,this._l=e,this.a="number"==typeof o?o:1,r<=0){const t=H(255*e);this.r=t,this.g=t,this.b=t}let i=0,n=0,s=0;const a=t/60,h=(1-Math.abs(2*e-1))*r,l=h*(1-Math.abs(a%2-1));a>=0&&a<1?(i=h,n=l):a>=1&&a<2?(i=l,n=h):a>=2&&a<3?(n=h,s=l):a>=3&&a<4?(n=l,s=h):a>=4&&a<5?(i=l,s=h):a>=5&&a<6&&(i=h,s=l);const c=e-h/2;this.r=H(255*(i+c)),this.g=H(255*(n+c)),this.b=H(255*(s+c))}fromHsv({h:t,s:r,v:e,a:o}){this._h=t%360,this._s=r,this._v=e,this.a="number"==typeof o?o:1;const i=H(255*e);if(this.r=i,this.g=i,this.b=i,r<=0)return;const n=t/60,s=Math.floor(n),a=n-s,h=H(e*(1-r)*255),l=H(e*(1-r*a)*255),c=H(e*(1-r*(1-a))*255);switch(s){case 0:this.g=c,this.b=h;break;case 1:this.r=l,this.b=h;break;case 2:this.r=h,this.b=c;break;case 3:this.r=h,this.g=l;break;case 4:this.r=c,this.g=h;break;default:this.g=h,this.b=l}}fromHsvString(t){const r=k(t,T);this.fromHsv({h:r[0],s:r[1],v:r[2],a:r[3]})}fromHslString(t){const r=k(t,T);this.fromHsl({h:r[0],s:r[1],l:r[2],a:r[3]})}fromRgbString(t){const r=k(t,((t,r)=>r.includes("%")?H(t/100*255):t));this.r=r[0],this.g=r[1],this.b=r[2],this.a=r[3]}}var C=2,A=.16,$=.05,_=.05,R=.15,F=5,W=4,L=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function z(t,r,e){var o;return(o=Math.round(t.h)>=60&&Math.round(t.h)<=240?e?Math.round(t.h)-C*r:Math.round(t.h)+C*r:e?Math.round(t.h)+C*r:Math.round(t.h)-C*r)<0?o+=360:o>=360&&(o-=360),o}function E(t,r,e){return 0===t.h&&0===t.s?t.s:((o=e?t.s-A*r:r===W?t.s+A:t.s+$*r)>1&&(o=1),e&&r===F&&o>.1&&(o=.1),o<.06&&(o=.06),Math.round(100*o)/100);var o}function P(t,r,e){var o;return o=e?t.v+_*r:t.v-R*r,o=Math.max(0,Math.min(1,o)),Math.round(100*o)/100}function I(t){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=[],o=new FastColor(t),i=o.toHsv(),n=F;n>0;n-=1){var s=new FastColor({h:z(i,n,!0),s:E(i,n,!0),v:P(i,n,!0)});e.push(s)}e.push(o);for(var a=1;a<=W;a+=1){var h=new FastColor({h:z(i,a),s:E(i,a),v:P(i,a)});e.push(h)}return"dark"===r.theme?L.map((function(t){var o=t.index,i=t.amount;return new FastColor(r.backgroundColor||"#141414").mix(e[o],i).toHexString()})):e.map((function(t){return t.toHexString()}))}const X={blue:"#1677ff",purple:"#722ED1",cyan:"#13C2C2",green:"#52C41A",pink:"#FC6572",red:"#F5222D",orange:"#FA8C16",yellow:"#FADB14",volcano:"#FA541C",geekblue:"#2F54EB",gossamer:"#069b81",gold:"#FAAD14",lime:"#A0D911",gray:"#818181"},N={id:"light",...X,colorPrimary:"#1677ff",colorSuccess:"#52c41a",colorWarning:"#faad14",colorError:"#ff4d4f",colorInfo:"#909399",colorLink:"#1677ff",colorTextBase:"",colorWhiteTextBase:"",colorBgBase:"",colorShadowBase:"",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,\n'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',\n'Noto Color Emoji'",fontSize:14,borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,zIndexBase:0,zIndexPopupBase:1e3};function j(t,{generateColorPalettes:r,generateNeutralColorPalettes:e}){const{colorSuccess:o,colorWarning:i,colorError:n,colorInfo:s,colorPrimary:a,colorBgBase:h,colorTextBase:l,colorWhiteTextBase:c,colorShadowBase:g}=t,u=r(a),f=r(o),d=r(i),b=r(n),m=r(s),y=e(h,l,c,g),S=r(t.colorLink||t.colorInfo);return{...y,colorPrimaryBg:u[1],colorPrimaryBgHover:u[2],colorPrimaryBorder:u[3],colorPrimaryBorderHover:u[4],colorPrimaryHover:u[5],colorPrimary:u[6],colorPrimaryActive:u[7],colorPrimaryTextHover:u[8],colorPrimaryText:u[9],colorPrimaryTextActive:u[10],colorPrimaryShadow:x(u[1],y.colorBgContainer),colorSuccessBg:f[1],colorSuccessBgHover:f[2],colorSuccessBorder:f[3],colorSuccessBorderHover:f[4],colorSuccessHover:f[4],colorSuccess:f[6],colorSuccessActive:f[7],colorSuccessTextHover:f[8],colorSuccessText:f[9],colorSuccessTextActive:f[10],colorSuccessShadow:x(f[1],y.colorBgContainer),colorErrorBg:b[1],colorErrorBgHover:b[2],colorErrorBorder:b[3],colorErrorBorderHover:b[4],colorErrorHover:b[5],colorError:b[6],colorErrorActive:b[7],colorErrorTextHover:b[8],colorErrorText:b[9],colorErrorTextActive:b[10],colorErrorShadow:x(b[1],y.colorBgContainer),colorWarningBg:d[1],colorWarningBgHover:d[2],colorWarningBorder:d[3],colorWarningBorderHover:d[4],colorWarningHover:d[4],colorWarning:d[6],colorWarningActive:d[7],colorWarningTextHover:d[8],colorWarningText:d[9],colorWarningTextActive:d[10],colorWarningShadow:x(d[1],y.colorBgContainer),colorInfoBg:m[1],colorInfoBgHover:m[2],colorInfoBorder:m[3],colorInfoBorderHover:m[4],colorInfoHover:m[4],colorInfo:m[6],colorInfoActive:m[7],colorInfoTextHover:m[8],colorInfoText:m[9],colorInfoTextActive:m[10],colorInfoShadow:x(m[1],y.colorBgContainer),colorLinkHover:S[4],colorLink:S[6],colorLinkActive:S[7],colorBgMask:new TinyColor("#000").setAlpha(.45).toRgbString(),colorWhite:"#fff",colorBlack:"#000"}}const q=(t,r)=>new TinyColor(t).setAlpha(r).toRgbString(),O=(t,r)=>new TinyColor(t).darken(r).toHexString(),D=t=>{const r=I(t);return{1:r[0],2:r[1],3:r[2],4:r[3],5:r[4],6:r[5],7:r[6],8:r[4],9:r[5],10:r[6]}},U=(t,r,e,o)=>{const i=t||"#fff",n=r||"#000";return{colorBgBase:i,colorTextBase:n,colorWhiteTextBase:e||"#fff",colorShadowBase:q(o||"#000",.02),colorText:q(n,.88),colorTextSecondary:q(n,.65),colorTextTertiary:q(n,.45),colorTextQuaternary:q(n,.25),colorFill:q(n,.15),colorFillSecondary:q(n,.06),colorFillTertiary:q(n,.04),colorFillQuaternary:q(n,.02),colorBgLayout:O(i,4),colorBgContainer:O(i,0),colorBgElevated:O(i,0),colorBgSpotlight:q(n,.85),colorBorder:O(i,15),colorBorderSecondary:O(i,6)}};function Q(t){const{sizeUnit:r,sizeStep:e}=t;return{sizeXXXL:r*(e+4),sizeXXL:r*(e+2),sizeXL:r*(e+1),sizeL:r*(e+.5),sizeM:r*e,size:r*e,sizeS:r*(e-.5),sizeXS:r*(e-1),sizeXXS:r*(e-1.5),sizeXXXS:r*(e-2)}}const V=t=>{let r=t,e=t,o=t,i=t,n=t;return t<6&&t>=5?r=t+3:t<16&&t>=6?r=t+6:t>=16&&(r=24),t<6&&t>=5?e=t+1:t<16&&t>=6?e=t+2:t>=16&&(e=16),t<7&&t>=5?o=4:t<8&&t>=7?o=5:t<14&&t>=8?o=6:t<16&&t>=14?o=7:t>=16&&(o=8),t<6&&t>=2?i=2:t>=6&&(i=4),t<6&&t>=2?n=1:t>=6&&(n=2),{borderRadiusXS:n,borderRadiusS:i,borderRadiusM:o,borderRadiusL:e,borderRadiusXL:r,borderRadius:t>16?16:t}};const G=t=>{const r=function(t){const r=new Array(10).fill(null).map(((r,e)=>{const o=t*1.8866**((e-1)/4),i=e>1?Math.floor(o):Math.ceil(o);return 2*Math.floor(i/2)}));return r[1]=t,r.map((t=>({size:t,lineHeight:(t+8)/t})))}(t),e=r.map((t=>t.size)),o=r.map((t=>t.lineHeight));return{fontSizeXXS:e[0],fontSizeXS:e[0],fontSizeS:e[1],fontSize:e[2],fontSizeM:e[2],fontSizeL:e[3],fontSizeXL:e[4],fontSizeXXL:e[5],fontSizeTitle1:e[6],fontSizeTitle2:e[5],fontSizeTitle3:e[4],fontSizeTitle4:e[3],fontSizeTitle5:e[2],lineHeight:o[2],lineHeightXL:o[4],lineHeightL:o[3],lineHeightM:o[2],lineHeightS:o[1],lineHeightXS:o[0],lineHeightTitle1:o[6],lineHeightTitle2:o[5],lineHeightTitle3:o[4],lineHeightTitle4:o[3],lineHeightTitle5:o[2]}};function J(t){const r=Object.keys(X).concat(["colorPrimary","colorSuccess","colorWarning","colorError","colorInfo"]).map((r=>{const e=I(t[r]);return new Array(10).fill(1).reduce(((t,o,i)=>(t[`${r}${i+1}`]=e[i],t)),{})})).reduce(((t,r)=>({...t,...r})),{});return{...t,...r,...j(t,{generateColorPalettes:D,generateNeutralColorPalettes:U}),...Q(t),...G(t.fontSize),...V(t.borderRadius),borderWidth:1,borderWidthS:.5,borderWidthM:1,borderWidthL:2,borderWidthXL:4,boxShadowWidth:2,boxShadowWidthS:4,boxShadowWidthM:6,boxShadowWidthL:12,padding:10,paddingXS:3,paddingS:5,paddingM:10,paddingL:15,paddingXL:20,margin:10,marginXS:3,marginS:5,marginM:10,marginL:15,marginXL:20}}const K=(t,r)=>new TinyColor(t).setAlpha(r).toRgbString(),Y=(t,r)=>new TinyColor(t).lighten(r).toHexString(),Z=t=>{const r=I(t,{theme:"dark"});return{1:r[0],2:r[1],3:r[2],4:r[3],5:r[6],6:r[5],7:r[4],8:r[6],9:r[5],10:r[4]}},tt=t=>new TinyColor(t).darken().toString(),rt=t=>new TinyColor(t).lighten().toString(),et=(t,r,e,o)=>{const i=t?tt(t):"#000",n=r?rt(r):"#fff",s=e?tt(e):"#000",a=o?rt(o):"#fff";return{colorBgBase:i,colorTextBase:n,colorWhiteTextBase:s,colorShadowBase:K(a,.12),colorText:K(n,.85),colorTextSecondary:K(n,.65),colorTextTertiary:K(n,.45),colorTextQuaternary:K(n,.25),colorFill:K(n,.18),colorFillSecondary:K(n,.12),colorFillTertiary:K(n,.08),colorFillQuaternary:K(n,.04),colorBgElevated:Y(i,12),colorBgContainer:Y(i,8),colorBgLayout:Y(i,0),colorBgSpotlight:Y(i,26),colorBorder:Y(i,26),colorBorderSecondary:Y(i,19)}};function ot(t,r){const e=Object.keys(X).concat(["colorPrimary","colorSuccess","colorWarning","colorError","colorInfo"]).map((r=>{const e=I(t[r],{theme:"dark"});return new Array(10).fill(1).reduce(((t,o,i)=>(t[`${r}${i+1}`]=e[i],t)),{})})).reduce(((t,r)=>({...t,...r})),{}),o=r??J(t);return o.id=o.id||"dark",{...o,...e,...j(t,{generateColorPalettes:Z,generateNeutralColorPalettes:et})}}const it=x;exports.createThemeList=t=>{const{themeList:r=[],useDark:e}=t||{},o=[];if(r&&r.length)for(let i=0;i<r.length;i++){const t=r[i],n=t.id||`${i}`;if(t.id=e?n+"-light":n,o.push(J({...N,...t})),e){const r=n+"-dark";o.push(ot({...N,...t,id:r}))}}else{const t=J({...N,id:"light"}),r=ot({...N,id:"dark"});o.push(t),o.push(r)}return o},exports.genAlphaColor=it;