From 6d55e398a528f40f7dd2c350e3e4e300dfc5bd00 Mon Sep 17 00:00:00 2001 From: Danry Ague <74456102+decanTyme@users.noreply.github.com> Date: Wed, 11 May 2022 15:48:42 +0800 Subject: [PATCH] fix(plugin): manually set fill target for boolean fill values --- src/plugin.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugin.ts b/src/plugin.ts index 213bbf8..6a8d7d8 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -57,7 +57,7 @@ const twColorsPlugin = ( return { id: "tailwindcss-colors", - beforeInit: (chart) => { + afterInit: (chart) => { const parsableOpts = [ "color", "borderColor", @@ -70,6 +70,7 @@ const twColorsPlugin = ( "pointHoverBorderColor", "fill.above", "fill.below", + "fill", ] parsableOpts.forEach((parsableOpt) => { @@ -81,7 +82,13 @@ const twColorsPlugin = ( get(dataset, parsableOpt) || (isValidTwColor(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)) + } }) }) },