Skip to content

Commit 25da720

Browse files
committed
fixed bug darkBackground default config
1 parent c0c496a commit 25da720

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gradin/tailwindcss-scrollbar",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "Tailwindcss plugin to customize scrollbar.",
55
"main": "src/index.js",
66
"scripts": {},

src/index.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,37 @@ const getSize = (options, theme) => {
77
return theme('scrollbar.DEFAULT.size', '5px') // with config
88
}
99
const getStyleTrack = (options, theme) => {
10-
const background = '#f1f1f1'
11-
const fromConfig = { // with config
12-
background,
13-
darkBackground: background,
14-
...theme('scrollbar.DEFAULT.track', {}),
10+
const defaultBackground = '#f1f1f1'
11+
const defaultConfig = {
12+
background: defaultBackground,
13+
darkBackground: defaultBackground,
1514
}
16-
const fromOptions = options && options.track ? options.track : {} // with plugin options
15+
const fromConfig = theme('scrollbar.DEFAULT.track', {}) // with tailwind.config.js
16+
const fromOptions = (options && options.track) ? options.track : {} // with plugin options
1717

18-
return { ...fromConfig, ...fromOptions }
18+
return { ...defaultConfig, ...fromConfig, ...fromOptions }
1919
}
2020
const getStyleThumb = (options, theme) => {
21-
const background = '#c1c1c1'
22-
const fromConfig = { // with config
23-
background,
24-
darkBackground: background,
25-
...theme('scrollbar.DEFAULT.thumb', {}),
21+
const defaultBackground = '#c1c1c1'
22+
const defaultConfig = {
23+
background: defaultBackground,
24+
darkBackground: defaultBackground,
2625
}
27-
const fromOptions = options && options.thumb ? options.thumb : {} // with plugin options
26+
const fromConfig = theme('scrollbar.DEFAULT.thumb', {}) // with tailwind.config.js
27+
const fromOptions = (options && options.thumb) ? options.thumb : {} // with plugin options
2828

29-
return { ...fromConfig, ...fromOptions }
29+
return { ...defaultConfig, ...fromConfig, ...fromOptions }
3030
}
3131
const getStyleThumbHover = (options, theme) => {
32-
const background = '#a8a8a8'
33-
const fromConfig = { // with config
34-
background,
35-
darkBackground: background,
36-
...theme('scrollbar.DEFAULT.hover', {}),
32+
const defaultBackground = '#a8a8a8'
33+
const defaultConfig = {
34+
background: defaultBackground,
35+
darkBackground: defaultBackground,
3736
}
38-
const fromOptions = options && options.hover ? options.hover : {} // with plugin options
37+
const fromConfig = theme('scrollbar.DEFAULT.hover', {}) // with tailwind.config.js
38+
const fromOptions = (options && options.hover) ? options.hover : {} // with plugin options
3939

40-
return { ...fromConfig, ...fromOptions }
40+
return { ...defaultConfig, ...fromConfig, ...fromOptions }
4141
}
4242

4343
module.exports = plugin.withOptions(function (options) {

0 commit comments

Comments
 (0)