Skip to content

Commit

Permalink
fixed bug darkBackground default config
Browse files Browse the repository at this point in the history
  • Loading branch information
christhofer committed Jul 14, 2022
1 parent c0c496a commit 25da720
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gradin/tailwindcss-scrollbar",
"version": "2.0.2",
"version": "2.0.3",
"description": "Tailwindcss plugin to customize scrollbar.",
"main": "src/index.js",
"scripts": {},
Expand Down
42 changes: 21 additions & 21 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,37 @@ const getSize = (options, theme) => {
return theme('scrollbar.DEFAULT.size', '5px') // with config
}
const getStyleTrack = (options, theme) => {
const background = '#f1f1f1'
const fromConfig = { // with config
background,
darkBackground: background,
...theme('scrollbar.DEFAULT.track', {}),
const defaultBackground = '#f1f1f1'
const defaultConfig = {
background: defaultBackground,
darkBackground: defaultBackground,
}
const fromOptions = options && options.track ? options.track : {} // with plugin options
const fromConfig = theme('scrollbar.DEFAULT.track', {}) // with tailwind.config.js
const fromOptions = (options && options.track) ? options.track : {} // with plugin options

return { ...fromConfig, ...fromOptions }
return { ...defaultConfig, ...fromConfig, ...fromOptions }
}
const getStyleThumb = (options, theme) => {
const background = '#c1c1c1'
const fromConfig = { // with config
background,
darkBackground: background,
...theme('scrollbar.DEFAULT.thumb', {}),
const defaultBackground = '#c1c1c1'
const defaultConfig = {
background: defaultBackground,
darkBackground: defaultBackground,
}
const fromOptions = options && options.thumb ? options.thumb : {} // with plugin options
const fromConfig = theme('scrollbar.DEFAULT.thumb', {}) // with tailwind.config.js
const fromOptions = (options && options.thumb) ? options.thumb : {} // with plugin options

return { ...fromConfig, ...fromOptions }
return { ...defaultConfig, ...fromConfig, ...fromOptions }
}
const getStyleThumbHover = (options, theme) => {
const background = '#a8a8a8'
const fromConfig = { // with config
background,
darkBackground: background,
...theme('scrollbar.DEFAULT.hover', {}),
const defaultBackground = '#a8a8a8'
const defaultConfig = {
background: defaultBackground,
darkBackground: defaultBackground,
}
const fromOptions = options && options.hover ? options.hover : {} // with plugin options
const fromConfig = theme('scrollbar.DEFAULT.hover', {}) // with tailwind.config.js
const fromOptions = (options && options.hover) ? options.hover : {} // with plugin options

return { ...fromConfig, ...fromOptions }
return { ...defaultConfig, ...fromConfig, ...fromOptions }
}

module.exports = plugin.withOptions(function (options) {
Expand Down

0 comments on commit 25da720

Please sign in to comment.