@@ -4,40 +4,46 @@ const getSize = (options, theme) => {
44 if ( options && options . size ) { // with plugin options
55 return options . size
66 }
7- return theme ( 'scrollbar.DEFAULT.size' , '5px' ) // with config
7+ return theme ( 'scrollbar.DEFAULT.size' , '5px' ) // with tailwind. config.js
88}
99const getStyleTrack = ( options , theme ) => {
10- const defaultBackground = '#f1f1f1'
11- const defaultConfig = {
12- background : defaultBackground ,
13- darkBackground : defaultBackground ,
14- }
10+ const background = '#f1f1f1' // default
1511 const fromConfig = theme ( 'scrollbar.DEFAULT.track' , { } ) // with tailwind.config.js
1612 const fromOptions = ( options && options . track ) ? options . track : { } // with plugin options
1713
18- return { ...defaultConfig , ...fromConfig , ...fromOptions }
14+ const finalConfig = { background, ...fromConfig , ...fromOptions }
15+
16+ if ( ! finalConfig . darkBackground ) {
17+ finalConfig . darkBackground = finalConfig . background
18+ }
19+
20+ return finalConfig
1921}
2022const getStyleThumb = ( options , theme ) => {
21- const defaultBackground = '#c1c1c1'
22- const defaultConfig = {
23- background : defaultBackground ,
24- darkBackground : defaultBackground ,
25- }
23+ const background = '#c1c1c1'
2624 const fromConfig = theme ( 'scrollbar.DEFAULT.thumb' , { } ) // with tailwind.config.js
2725 const fromOptions = ( options && options . thumb ) ? options . thumb : { } // with plugin options
2826
29- return { ...defaultConfig , ...fromConfig , ...fromOptions }
27+ const finalConfig = { background, ...fromConfig , ...fromOptions }
28+
29+ if ( ! finalConfig . darkBackground ) {
30+ finalConfig . darkBackground = finalConfig . background
31+ }
32+
33+ return finalConfig
3034}
3135const getStyleThumbHover = ( options , theme ) => {
32- const defaultBackground = '#a8a8a8'
33- const defaultConfig = {
34- background : defaultBackground ,
35- darkBackground : defaultBackground ,
36- }
36+ const background = '#a8a8a8'
3737 const fromConfig = theme ( 'scrollbar.DEFAULT.hover' , { } ) // with tailwind.config.js
3838 const fromOptions = ( options && options . hover ) ? options . hover : { } // with plugin options
3939
40- return { ...defaultConfig , ...fromConfig , ...fromOptions }
40+ const finalConfig = { background, ...fromConfig , ...fromOptions }
41+
42+ if ( ! finalConfig . darkBackground ) {
43+ finalConfig . darkBackground = finalConfig . background
44+ }
45+
46+ return finalConfig
4147}
4248
4349module . exports = plugin . withOptions ( function ( options ) {
0 commit comments