File tree Expand file tree Collapse file tree 6 files changed +32
-15
lines changed Expand file tree Collapse file tree 6 files changed +32
-15
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,27 @@ new LoadingScreenPlugin({
100100})
101101```
102102
103+ ### theme
104+
105+ - Type: ` ThemeConfig `
106+ - Default: ` DefaultThemeConfig `
107+
108+ Customize loading screen progress bar color.
109+
110+ ``` ts
111+ interface ThemeConfig {
112+ client? : string
113+ server? : string
114+ modern? : string
115+ }
116+
117+ const DefaultThemeConfig = {
118+ client: ' #8ed5fb' ,
119+ server: ' #1b78bf' ,
120+ modern: ' #2f495e'
121+ }
122+ ```
123+
103124### env
104125
105126- Type: ` 'development' | 'production' `
Original file line number Diff line number Diff line change 2121 <div v-for =" bundle of bundles" :key =" bundle" class =" row" >
2222 <h3 >{{ bundle | capitalize }} bundle</h3 >
2323 <div class =" progress_bar_container" >
24- <div class =" progress_bar" :class = " bundle " : style =" { width: `${states[bundle].progress}%` }" />
24+ <div class =" progress_bar" :style =" { width: `${states[bundle].progress}%`, backgroundColor: theme[bundle] }" />
2525 </div >
2626 <h4 >{{ states[bundle].status }}</h4 >
2727 </div >
@@ -72,7 +72,8 @@ export default {
7272 isFinished: false ,
7373 baseURL: window .$BASE_URL ,
7474 bundles: [],
75- states: {}
75+ states: {},
76+ theme: window .$THEME
7677 }
7778 },
7879
Original file line number Diff line number Diff line change 7676 width : 10px ;
7777 transition : width 0.4s ;
7878}
79-
80- .progress_bar .client {
81- background-color : # 8ed5fb ;
82- }
83-
84- .progress_bar .server {
85- background-color : # 1b78bf ;
86- }
87-
88- .progress_bar .modern {
89- background-color : # 2F495E ;
90- }
91-
Original file line number Diff line number Diff line change 1010 <!-- loading_app -->
1111 < div id ="webpack_loading_screen "> </ div >
1212 < script > window . $STATE = { STATE } </ script >
13+ < script > window . $THEME = { THEME } </ script >
1314 < script > window . $LOGO = '{LOGO}' </ script >
1415 < script > window . $BASE_URL = '{BASE_URL}' </ script >
1516</ body >
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ class LoadingUI {
1212 this . baseURL = opts . baseURL
1313
1414 this . logo = opts . logo
15+ this . theme = opts . theme
1516
1617 this . serveIndex = this . serveIndex . bind ( this )
1718 this . serveWS = this . serveWS . bind ( this )
@@ -89,6 +90,7 @@ class LoadingUI {
8990 res . end (
9091 this . indexTemplate
9192 . replace ( '{STATE}' , JSON . stringify ( this . state ) )
93+ . replace ( '{THEME}' , JSON . stringify ( this . theme ) )
9294 . replace ( '{LOGO}' , this . logo )
9395 . replace ( / { B A S E _ U R L } / g, this . baseURL )
9496 )
Original file line number Diff line number Diff line change @@ -13,6 +13,11 @@ module.exports = class ProgressPlugin extends Plugin {
1313 port : process . env . port || 4000 ,
1414 callback : ( ) => {
1515 console . log ( `[loading screen]: http://localhost:${ this . opts . port } ` )
16+ } ,
17+ theme : {
18+ client : '#8ed5fb' ,
19+ server : '#1b78bf' ,
20+ modern : '#2f495e'
1621 }
1722 } ,
1823 opts
You can’t perform that action at this time.
0 commit comments