Reusable Custom Palette

To create palettes to be used anywhere on your any parts of your app, you can use ApexCharts::Theme.create.

For example, in rails app, you would write it in initializers:

# config/initializers/apexcharts.rb
ApexCharts::Theme.create "rainbow", ["#ff0000", "#00ff00", "#0000ff"]

and later somewhere in your app views:

# e.g. app/views/home/index.html.slim
...
= line_chart chart_data, theme: "rainbow"
...

If later for some reason I don't know you want to destroy the palette you can use:

ApexCharts::Theme.destroy "rainbow"

Last updated