Skip to content

Commit

Permalink
fix(plugin): manually set fill target for boolean fill values
Browse files Browse the repository at this point in the history
  • Loading branch information
decanTyme committed Feb 11, 2023
1 parent 972d019 commit 6d55e39
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const twColorsPlugin = (

return {
id: "tailwindcss-colors",
beforeInit: (chart) => {
afterInit: (chart) => {
const parsableOpts = [
"color",
"borderColor",
Expand All @@ -70,6 +70,7 @@ const twColorsPlugin = (
"pointHoverBorderColor",
"fill.above",
"fill.below",
"fill",
]

parsableOpts.forEach((parsableOpt) => {
Expand All @@ -81,7 +82,13 @@ const twColorsPlugin = (
get(dataset, parsableOpt) ||
(isValidTwColor(<string>chartOpt) ? chartOpt : defaultOpt)

set(dataset, parsableOpt, parseTailwindColor(color))
if (color) {
if (typeof color === "boolean") {
// Manually set for boolean fill option values,
// otherwise fill won't work
set(dataset, parsableOpt, { target: "origin" })
} else set(dataset, parsableOpt, parseTailwindColor(color))
}
})
})
},
Expand Down

0 comments on commit 6d55e39

Please sign in to comment.