by nagix

Predefined color schemes for Chart.js

167 Stars 20 Forks Last release: over 1 year ago (v0.4.0) MIT License 24 Commits 4 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


npm Bower Travis Coverage Maintainability Awesome

Predefined color schemes for Chart.js

You can pick the perfect color combination for your charts from the predefined color schemes, which are based on popular tools such as ColorBrewer, Microsoft Office and Tableau.

This plugin requires Chart.js 2.5.0 or later.


You can download the latest version of chartjs-plugin-colorschemes from the GitHub releases.

To install via npm:

npm install chartjs-plugin-colorschemes --save

To install via bower:

bower install chartjs-plugin-colorschemes --save

To use CDN:


chartjs-plugin-colorschemes can be used with ES6 modules, plain JavaScript and module loaders.

Include Chart.js and chartjs-plugin-colorschemes.js to your page, and specify a color scheme as shown in the example below. You can pick a scheme from Color Chart.

    options: {
        plugins: {
            colorschemes: {
                scheme: 'brewer.Paired12'

Every color scheme has a number at the end of its name, which indicates the number of that colors included in the scheme. If the number of the datasets is larger than it, the same colors will appear repeatedly. A color is not modified if it is specified by dataset options.

Usage in ES6 as Module

Nothing else than importing the module should be enough.

import 'chartjs-plugin-colorschemes';

If you want to reduce the size by only importing the plugin core and particular color schemes, see the example below.

// import the plugin core
import 'chartjs-plugin-colorschemes/src/plugins/plugin.colorschemes';

// import a particular color scheme import { Aspect6 } from 'chartjs-plugin-colorschemes/src/colorschemes/';

// ... options: { plugins: { colorschemes: { scheme: Aspect6 } } } //...


You can find a tutorial at


The plugin options can be changed at 2 different levels and with the following priority:

  • per chart:
  • globally:*

All available options are listed below.

| Name | Type | Default | Description | ---- | ---- | ------- | ----------- |

| The transparency value for the line fill color. Must be a number between
(fully transparent) and
(no transparency). |
| string|string[] |
| Color scheme name that is any of Color Chart. It also accepts an array of color strings, which is primarily for ES modules. more... |
| If set to
, the order of the colors in the selected scheme is reversed. |
| If set to
, the specified color scheme will override the existing color options. If
, it is only applied when no color setting exists. more... |
| A function that takes a copy of the color string array for
in order to extend the predefined scheme colors. more...

Overriding Existing Color Settings

By default, this plugin doesn't apply a color scheme if any color options are already specified. This may cause a problem if you are using a third party library such as ng-charts, which automatically applies default color settings. In that case, the existing color settings can be overridden by setting the

option to


With the help of the

-Function you can extend the predefined scheme colors. This function takes a copy of the current scheme and is expected to return an array with at least one element. See the example below.
var customColorFunction = function(schemeColors) {
    var myColors = ['#ff0000', '#00ff00', '#0000ff']; // define/generate own colors

// extend the color scheme with own colors
Array.prototype.push.apply(schemeColors, myColors);

return schemeColors; // optional: this is not needed if the array is modified in place


// ... options: { plugins: { colorschemes: { scheme: 'brewer.Paired12', custom: customColorFunction } } } //...


You first need to install node dependencies (requires Node.js):

npm install

The following commands will then be available from the repository root:

gulp build            # build dist files
gulp build --watch    # build and watch for changes
gulp test             # run all tests
gulp test --watch     # run all tests and watch for changes
gulp test --coverage  # run all tests and generate code coverage
gulp lint             # perform code linting
gulp package          # create an archive with dist files and samples


chartjs-plugin-colorschemes is available under the MIT license.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.