importclientfrom'webpack-theme-color-replacer/client';import{generate}from'@ant-design/colors';importpkgfrom'../../../package.json';exportdefault{getAntdSerials(color){// 淡化(即less的tint)constlightens=newArray(9).fill().map((t,i)=>client.varyColor.lighten(color,i/10));// colorPalette变换得到颜色值constcolorPalettes=generate(color);constrgb=client.varyColor.toNum3(color.replace('#','')).join(',');returnlightens.concat(colorPalettes).concat(rgb);},changeColor(newColor){constoptions={newColors:this.getAntdSerials(newColor),// new colors array, one-to-one corresponde with `matchColors`changeUrl(cssUrl){return`/${pkg.name.toLowerCase()}/${cssUrl}`;// while router is not `hash` mode, it needs absolute path},};returnclient.changer.changeColor(options,Promise);},};