Closed TedCha closed 3 months ago
I thought the idea was to not support this kind of customization. If you want this you can use an existing or custom plugin or just pass your own colors
@LeeLenaleee Thanks for the reply. I didn't realize that the fixed color palette was intentional. You're right that it's easy to create a custom plugin that's similar to the existing Colors plugin but I thought it would be an relatively easy thing to build in and give the user more color palette flexibility while still being able to rely on the defaults.
Though completely understand if the fixed color palette is by design for default standardization. I'll close the ticket if so.
Closing this issue as this is not something we are going to support.
There are 2 external plugins that can be used depending on your version of chart.js:
Feature Proposal
I believe it would be a useful feature to allow the default color palette of the chart.js Colors plugin to be adjustable by a user before registration. This would allow for a custom color palette to be initialized once rather than in every chart that is defined.
Possible Implementation
Looking at the implementation, I think this would be achievable by defining a
palette
parameter within the defaults and options and then using that property instead of theBORDER_COLORS
constant to store the default colors. The options parameter of thebeforeLayout
function would need to be passed down to where the color retrieval takes place (e.g.getBorderColor
andgetBackgroundColor
).