jccoca/filament-chart-palette
A Filament plugin for defining and managing chart color palettes, helping you keep dashboard widgets and charts visually consistent. Configure reusable colors and apply them across your Filament panels with minimal setup.
composer require jccoca/filament-chart-palette. No publish/config step is mentioned in the release notes, so there is nothing to publish before first use.README.md (linked from the release) for the full palette API, supported chart types, and shade syntax. The release notes only show the happy path.use HasChartPalette; inside your ChartWidget, then call $this->getChartPalette($this->getType()) inside getData() and feed the result into a dataset color key (typically backgroundColor).backgroundColor and Chart.js will distribute one color per slice.Color::class and Tailwind v4 OKLCH values, your first sanity check should be that the rendered colors visually match the rest of your Filament panel theme (light and dark).getData(). Keep the trait on the ChartWidget subclass and resolve the palette at data-build time. This keeps color logic co-located with the dataset it colors.getType() drive ordering. Pass $this->getType() so the package can order colors appropriately per chart type (adjacent-slice contrast for pie/doughnut vs. series contrast for bar/line). Avoid hardcoding 'pie' if the widget type can change.$palette[0], $palette[1], …) rather than passing the full array to every dataset, otherwise all series share the same color ramp.borderColor and a low-alpha variant for backgroundColor (fill).protected function palette(): array) so shade, type, and ordering choices are defined once and reused across all chart widgets.Color::class, changing the panel's primary color should cascade into charts automatically — treat that as the intended workflow and avoid hardcoded hex fallbacks.oklch()) receives valid colors. Let the package convert; don't pre-convert in your own code.rgba()/hex, not oklch(). If you bypass the package and hand Tailwind v4 OKLCH values straight to a dataset, colors will silently fail or render black — always route through getChartPalette().getType() returns something outside the package's known set, ordering may fall back to a default. Verify slice contrast on less common types (polarArea, radar) rather than assuming.backgroundColor behind labels.Color::class behavior to differ; pin jccoca/filament-chart-palette and filament/filament together in composer.json and retest on Filament minor upgrades, since v5 Color internals are the package's main dependency surface.dd($this->getChartPalette($this->getType())) inside getData() is the fastest way to confirm ordering, count, and RGBA formatting before blaming Chart.js options.count($palette) against your dataset size, especially for dynamic/query-driven charts.getChartPalette() in your widget or base class to inject brand colors or custom ordering while keeping the rest of the package's conversion behavior. Prefer that over post-processing the returned array in every getData().getData() and assert the palette shape (array of valid rgba(...) strings, correct count) so Filament/Tailwind upgrades that shift color values fail loudly in CI rather than visually in production.How can I help you explore Laravel packages today?