import client from 'webpack-theme-color-replacer/client' ; import generate from '@ant-design/colors/lib/generate' ; export default { getAntdSerials ( color ) { const lightCount = 9 ; const divide = 10 ; let lightens = new Array ( lightCount ) . fill ( 0 ) ; lightens = lightens . map ( ( _ , i ) => client . varyColor . lighten ( color , i / divide ) ) ; const colorPalettes = generate ( color ) ; const rgb = client . varyColor . toNum3 ( color . replace ( '#' , '' ) ) . join ( ',' ) ; return lightens . concat ( colorPalettes ) . concat ( rgb ) ; } , changeColor ( color ? ) { if ( ! color ) { return Promise . resolve ( ) ; } const options = { newColors : this . getAntdSerials ( color ) , changeUrl ( cssUrl ) { return `/${ cssUrl }` ; } , } ; return client . changer . changeColor ( options , Promise ) ; } , } ;