Gathering detailed insights and metrics for chartjs-plugin-colorschemes
Gathering detailed insights and metrics for chartjs-plugin-colorschemes
Gathering detailed insights and metrics for chartjs-plugin-colorschemes
Gathering detailed insights and metrics for chartjs-plugin-colorschemes
@types/chartjs-plugin-colorschemes
TypeScript definitions for chartjs-plugin-colorschemes
chartjs-plugin-colorschemes-v3
Predefined color schemes for Chart.js
hw-chartjs-plugin-colorschemes
Predefined color schemes for Chart.js
chartjs-node-plugin-colorschemes
Nodejs compatible fork of chartjs-plugin-colorschemes
npm install chartjs-plugin-colorschemes
Typescript
Module System
Node Version
NPM Version
89.7
Supply Chain
97.9
Quality
74.9
Maintenance
100
Vulnerability
100
License
JavaScript (98.27%)
Shell (1.73%)
Built with Next.js • Fully responsive • SEO optimized • Open source ready
Total Downloads
2,396,120
Last Day
528
Last Week
9,771
Last Month
33,306
Last Year
365,653
MIT License
275 Stars
27 Commits
58 Forks
8 Watchers
2 Branches
5 Contributors
Updated on Aug 26, 2025
Latest Version
0.4.0
Package Id
chartjs-plugin-colorschemes@0.4.0
Size
46.82 kB
NPM Version
6.9.0
Node Version
10.16.0
Published on
May 31, 2019
Cumulative downloads
Total Downloads
Last Day
259.2%
528
Compared to previous day
Last Week
28.5%
9,771
Compared to previous week
Last Month
-1.6%
33,306
Compared to previous month
Last Year
-10.3%
365,653
Compared to previous year
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:
1npm install chartjs-plugin-colorschemes --save
To install via bower:
1bower install chartjs-plugin-colorschemes --save
To use CDN:
1<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-colorschemes"></script>
1<script src="https://unpkg.com/chartjs-plugin-colorschemes"></script>
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.
1 options: { 2 plugins: { 3 colorschemes: { 4 scheme: 'brewer.Paired12' 5 } 6 } 7 }
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.
Nothing else than importing the module should be enough.
1import 'chartjs-plugin-colorschemes';
If you want to reduce the size by only importing the plugin core and particular color schemes, see the example below.
1// import the plugin core 2import 'chartjs-plugin-colorschemes/src/plugins/plugin.colorschemes'; 3 4// import a particular color scheme 5import { Aspect6 } from 'chartjs-plugin-colorschemes/src/colorschemes/colorschemes.office'; 6 7// ... 8 options: { 9 plugins: { 10 colorschemes: { 11 scheme: Aspect6 12 } 13 } 14 } 15//...
You can find a tutorial at nagix.github.io/chartjs-plugin-colorschemes.
The plugin options can be changed at 2 different levels and with the following priority:
options.plugins.colorschemes.*
Chart.defaults.global.plugins.colorschemes.*
All available options are listed below.
Name | Type | Default | Description |
---|---|---|---|
fillAlpha | number | 0.5 | The transparency value for the line fill color. Must be a number between 0.0 (fully transparent) and 1.0 (no transparency). |
scheme | string|string[] | 'brewer.Paired12' | Color scheme name that is any of Color Chart. It also accepts an array of color strings, which is primarily for ES modules. more... |
reverse | boolean | false | If set to true , the order of the colors in the selected scheme is reversed. |
override | boolean | false | If set to true , the specified color scheme will override the existing color options. If false , it is only applied when no color setting exists. more... |
custom | function | undefined | A function that takes a copy of the color string array for scheme in order to extend the predefined scheme colors. more... |
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 override
option to true
.
custom
-FunctionWith the help of the custom
-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.
1var customColorFunction = function(schemeColors) { 2 var myColors = ['#ff0000', '#00ff00', '#0000ff']; // define/generate own colors 3 4 // extend the color scheme with own colors 5 Array.prototype.push.apply(schemeColors, myColors); 6 7 return schemeColors; // optional: this is not needed if the array is modified in place 8}; 9 10// ... 11 options: { 12 plugins: { 13 colorschemes: { 14 scheme: 'brewer.Paired12', 15 custom: customColorFunction 16 } 17 } 18 } 19//... 20
You first need to install node dependencies (requires Node.js):
1npm install
The following commands will then be available from the repository root:
1gulp build # build dist files 2gulp build --watch # build and watch for changes 3gulp lint # perform code linting 4gulp package # create an archive with dist files and samples
chartjs-plugin-colorschemes is available under the MIT license.
No vulnerabilities found.