@@ -4,40 +4,46 @@ const getSize = (options, theme) => {
4
4
if ( options && options . size ) { // with plugin options
5
5
return options . size
6
6
}
7
- return theme ( 'scrollbar.DEFAULT.size' , '5px' ) // with config
7
+ return theme ( 'scrollbar.DEFAULT.size' , '5px' ) // with tailwind. config.js
8
8
}
9
9
const getStyleTrack = ( options , theme ) => {
10
- const defaultBackground = '#f1f1f1'
11
- const defaultConfig = {
12
- background : defaultBackground ,
13
- darkBackground : defaultBackground ,
14
- }
10
+ const background = '#f1f1f1' // default
15
11
const fromConfig = theme ( 'scrollbar.DEFAULT.track' , { } ) // with tailwind.config.js
16
12
const fromOptions = ( options && options . track ) ? options . track : { } // with plugin options
17
13
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
19
21
}
20
22
const getStyleThumb = ( options , theme ) => {
21
- const defaultBackground = '#c1c1c1'
22
- const defaultConfig = {
23
- background : defaultBackground ,
24
- darkBackground : defaultBackground ,
25
- }
23
+ const background = '#c1c1c1'
26
24
const fromConfig = theme ( 'scrollbar.DEFAULT.thumb' , { } ) // with tailwind.config.js
27
25
const fromOptions = ( options && options . thumb ) ? options . thumb : { } // with plugin options
28
26
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
30
34
}
31
35
const getStyleThumbHover = ( options , theme ) => {
32
- const defaultBackground = '#a8a8a8'
33
- const defaultConfig = {
34
- background : defaultBackground ,
35
- darkBackground : defaultBackground ,
36
- }
36
+ const background = '#a8a8a8'
37
37
const fromConfig = theme ( 'scrollbar.DEFAULT.hover' , { } ) // with tailwind.config.js
38
38
const fromOptions = ( options && options . hover ) ? options . hover : { } // with plugin options
39
39
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
41
47
}
42
48
43
49
module . exports = plugin . withOptions ( function ( options ) {
0 commit comments