├── .codeclimate.yml
├── .eslintignore
├── .eslintrc.yml
├── .gitignore
├── .npmignore
├── .travis.yml
├── LICENSE.md
├── README.md
├── docs
├── .eslintrc.yml
├── colorchart.html
├── index.html
└── ja
│ └── index.html
├── gulpfile.js
├── karma.config.js
├── package.json
├── rollup.config.js
├── samples
├── .eslintrc.yml
└── index.html
├── scripts
└── release.sh
├── src
├── colorschemes
│ ├── colorschemes.brewer.js
│ ├── colorschemes.office.js
│ ├── colorschemes.tableau.js
│ └── index.js
├── index.js
└── plugins
│ └── plugin.colorschemes.js
└── test
├── .eslintrc.yml
├── fixture.js
├── fixtures
└── plugin.colorschemes
│ ├── chart-bar-fillAlpha.js
│ ├── chart-bar-fillAlpha.png
│ ├── chart-bar.js
│ ├── chart-bar.png
│ ├── chart-bubble.js
│ ├── chart-bubble.png
│ ├── chart-doughnut.js
│ ├── chart-doughnut.png
│ ├── chart-horizontal-bar.js
│ ├── chart-horizontal-bar.png
│ ├── chart-line.js
│ ├── chart-line.png
│ ├── chart-pie.js
│ ├── chart-pie.png
│ ├── chart-polar-area.js
│ ├── chart-polar-area.png
│ ├── chart-radar.js
│ ├── chart-radar.png
│ ├── chart-scatter.js
│ └── chart-scatter.png
├── index.js
├── matchers.js
├── specs
└── plugin.colorschemes.spec.js
└── utils.js
/.codeclimate.yml:
--------------------------------------------------------------------------------
1 | engines:
2 | duplication:
3 | enabled: true
4 | config:
5 | languages:
6 | - javascript
7 | eslint:
8 | enabled: true
9 | channel: "eslint-3"
10 | fixme:
11 | enabled: true
12 | ratings:
13 | paths:
14 | - "samples/**/*.js"
15 | - "src/**/*.js"
16 | exclude_paths:
17 | - dist/**/*
18 | - docs/**/*
19 | - node_modules/**/*
20 | - test/**/*
21 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | **/*{.,-}min.js
2 | docs/index.html
3 | docs/colorchart.html
4 | docs/ja/index.html
5 |
--------------------------------------------------------------------------------
/.eslintrc.yml:
--------------------------------------------------------------------------------
1 | extends: chartjs
2 |
3 | parserOptions:
4 | sourceType: module
5 |
6 | env:
7 | browser: true
8 | node: true
9 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .vscode
3 | bower.json
4 | cc-test-reporter
5 | coverage/
6 | dist/
7 | node_modules/
8 | package-lock.json
9 | *.swp
10 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | /.git
2 | /dist/*.zip
3 | /node_modules
4 | /scripts
5 |
6 | .codeclimate.yml
7 | .DS_Store
8 | .gitignore
9 | .idea
10 | .travis.yml
11 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - lts/*
4 |
5 | before_script:
6 | - export DISPLAY=:99.0
7 | - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
8 | - chmod +x ./cc-test-reporter
9 | - ./cc-test-reporter before-build
10 |
11 | # Syntax replaces old method of invoking xvfb directly
12 | services:
13 | - xvfb
14 |
15 | script:
16 | - gulp test --coverage
17 | - gulp lint
18 | - gulp package
19 | - gulp bower
20 |
21 | after_script:
22 | - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
23 |
24 | # IMPORTANT: scripts require GITHUB_AUTH_TOKEN and GITHUB_AUTH_EMAIL environment variables
25 | # IMPORTANT: scripts has to be set executables in the Git repository (error 127)
26 | # https://github.com/travis-ci/travis-ci/issues/5538#issuecomment-225025939
27 | # http://stackoverflow.com/a/15572639
28 |
29 | deploy:
30 | - provider: script
31 | script: ./scripts/release.sh
32 | skip_cleanup: true
33 | on:
34 | branch: release
35 | - provider: releases
36 | api_key: $GITHUB_AUTH_TOKEN
37 | file:
38 | - "./dist/chartjs-plugin-colorschemes.js"
39 | - "./dist/chartjs-plugin-colorschemes.min.js"
40 | - "./dist/chartjs-plugin-colorschemes.zip"
41 | skip_cleanup: true
42 | on:
43 | tags: true
44 | - provider: npm
45 | email: $NPM_AUTH_EMAIL
46 | api_key: $NPM_AUTH_TOKEN
47 | skip_cleanup: true
48 | on:
49 | tags: true
50 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2019 Akihiko Kusanagi
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # chartjs-plugin-colorschemes
2 |
3 | [](https://npmjs.com/package/chartjs-plugin-colorschemes) [](https://libraries.io/bower/chartjs-plugin-colorschemes) [](https://travis-ci.org/nagix/chartjs-plugin-colorschemes) [](https://codeclimate.com/github/nagix/chartjs-plugin-colorschemes) [](https://codeclimate.com/github/nagix/chartjs-plugin-colorschemes) [](https://github.com/chartjs/awesome)
4 |
5 | *Predefined color schemes for [Chart.js](https://www.chartjs.org)*
6 |
7 | You can pick the perfect color combination for your charts from the predefined color schemes, which are based on popular tools such as [ColorBrewer](http://colorbrewer2.org), [Microsoft Office](https://products.office.com) and [Tableau](https://www.tableau.com).
8 |
9 | This plugin requires Chart.js 2.5.0 or later.
10 |
11 | ## Installation
12 |
13 | You can download the latest version of chartjs-plugin-colorschemes from the [GitHub releases](https://github.com/nagix/chartjs-plugin-colorschemes/releases/latest).
14 |
15 | To install via npm:
16 |
17 | ```bash
18 | npm install chartjs-plugin-colorschemes --save
19 | ```
20 |
21 | To install via bower:
22 |
23 | ```bash
24 | bower install chartjs-plugin-colorschemes --save
25 | ```
26 |
27 | To use CDN:
28 |
29 | ```html
30 |
31 | ```
32 | ```html
33 |
34 | ```
35 |
36 | ## Usage
37 |
38 | chartjs-plugin-colorschemes can be used with ES6 modules, plain JavaScript and module loaders.
39 |
40 | 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](https://nagix.github.io/chartjs-plugin-colorschemes/colorchart.html).
41 |
42 | ```js
43 | options: {
44 | plugins: {
45 | colorschemes: {
46 | scheme: 'brewer.Paired12'
47 | }
48 | }
49 | }
50 | ```
51 |
52 | 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.
53 |
54 | ### Usage in ES6 as Module
55 |
56 | Nothing else than importing the module should be enough.
57 |
58 | ```js
59 | import 'chartjs-plugin-colorschemes';
60 | ```
61 |
62 | If you want to reduce the size by only importing the plugin core and particular color schemes, see the example below.
63 |
64 | ```js
65 | // import the plugin core
66 | import 'chartjs-plugin-colorschemes/src/plugins/plugin.colorschemes';
67 |
68 | // import a particular color scheme
69 | import { Aspect6 } from 'chartjs-plugin-colorschemes/src/colorschemes/colorschemes.office';
70 |
71 | // ...
72 | options: {
73 | plugins: {
74 | colorschemes: {
75 | scheme: Aspect6
76 | }
77 | }
78 | }
79 | //...
80 | ```
81 |
82 | ## Tutorial
83 |
84 | You can find a tutorial at [nagix.github.io/chartjs-plugin-colorschemes](https://nagix.github.io/chartjs-plugin-colorschemes).
85 |
86 | ## Configuration
87 |
88 | The plugin options can be changed at 2 different levels and with the following priority:
89 |
90 | - per chart: `options.plugins.colorschemes.*`
91 | - globally: `Chart.defaults.global.plugins.colorschemes.*`
92 |
93 | All available options are listed below.
94 |
95 | | Name | Type | Default | Description
96 | | ---- | ---- | ------- | -----------
97 | | `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).
98 | | `scheme` | string|string[]
| `'brewer.Paired12'` | Color scheme name that is any of [Color Chart](https://nagix.github.io/chartjs-plugin-colorschemes/colorchart.html). It also accepts an array of color strings, which is primarily for ES modules. [more...](#usage-in-es6-as-module)
99 | | `reverse` | `boolean` | `false` | If set to `true`, the order of the colors in the selected scheme is reversed.
100 | | `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...](#overriding-existing-color-settings)
101 | | `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...](#custom-function)
102 |
103 | ### Overriding Existing Color Settings
104 |
105 | 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](https://valor-software.com/ng2-charts/), which automatically applies default color settings. In that case, the existing color settings can be overridden by setting the `override` option to `true`.
106 |
107 | ### `custom`-Function
108 |
109 | With 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.
110 |
111 | ```js
112 | var customColorFunction = function(schemeColors) {
113 | var myColors = ['#ff0000', '#00ff00', '#0000ff']; // define/generate own colors
114 |
115 | // extend the color scheme with own colors
116 | Array.prototype.push.apply(schemeColors, myColors);
117 |
118 | return schemeColors; // optional: this is not needed if the array is modified in place
119 | };
120 |
121 | // ...
122 | options: {
123 | plugins: {
124 | colorschemes: {
125 | scheme: 'brewer.Paired12',
126 | custom: customColorFunction
127 | }
128 | }
129 | }
130 | //...
131 |
132 | ```
133 |
134 | ### `custom` colorscheme from scratch
135 |
136 | It is possible to build your custom colorscheme from scratch (without using the `custom` function) by simply defining the colors it contains. See example below.
137 |
138 | ```js
139 | var myColors = ['red', 'green', 'blue', 'orange', 'black', 'yellow'];
140 |
141 | // ...
142 | options: {
143 | plugins: {
144 | colorschemes: {
145 | scheme: myColors
146 | }
147 | }
148 | }
149 | //...
150 |
151 | ```
152 |
153 | ## Building
154 |
155 | You first need to install node dependencies (requires [Node.js](https://nodejs.org/)):
156 |
157 | ```bash
158 | npm install
159 | ```
160 |
161 | The following commands will then be available from the repository root:
162 |
163 | ```bash
164 | gulp build # build dist files
165 | gulp build --watch # build and watch for changes
166 | gulp test # run all tests
167 | gulp test --watch # run all tests and watch for changes
168 | gulp test --coverage # run all tests and generate code coverage
169 | gulp lint # perform code linting
170 | gulp package # create an archive with dist files and samples
171 | ```
172 |
173 | ## License
174 |
175 | chartjs-plugin-colorschemes is available under the [MIT license](https://opensource.org/licenses/MIT).
176 |
--------------------------------------------------------------------------------
/docs/.eslintrc.yml:
--------------------------------------------------------------------------------
1 | plugins: [es, html]
2 |
3 | extends: [
4 | plugin:es/no-2018,
5 | plugin:es/no-2017,
6 | plugin:es/no-2016,
7 | plugin:es/no-2015
8 | ]
9 |
10 | globals:
11 | Chart: true
12 | XLSX: true
13 | ChartDataSource: true
14 |
15 | parserOptions:
16 | sourceType: script
17 |
18 | rules:
19 | no-unused-vars: 0
20 |
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | chartjs-plugin-colorschemes
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | chartjs-plugin-colorschemes
22 |
23 | 日本語
24 |
25 |
26 | Predefined color schemes for Chart.js . Pick the perfect color combination for your data visualization.
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | Include scripts
36 | First, we need to include Chart.js and chartjs-plugin-colorschemes.js in our page.
37 |
38 |
39 |
40 |
<script type="text/javascript" src="Chart.js"></script>
41 |
<script type="text/javascript" src="chartjs-plugin-colorschemes.js"></script>
42 |
43 |
44 |
45 |
46 |
47 | Create a canvas
48 | We need to have a canvas in our page.
49 |
50 |
51 |
52 |
<canvas id="myChart"></canvas>
53 |
54 |
55 |
56 |
57 |
58 | Create a chart
59 | Now, we can create a chart. We add a script to our page. Random number datasets are generated in this example.
60 |
61 |
62 |
63 |
var ctx = document.getElementById('myChart').getContext('2d');
64 |
var chart = new Chart(ctx, {
65 |
type: 'line',
66 |
data: {
67 |
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
68 |
datasets: [1, 2, 3].map(function(i) {
69 |
return {
70 |
label: 'Dataset ' + i,
71 |
data: [0, 0, 0, 0, 0, 0, 0].map(Math.random),
72 |
fill: false
73 |
};
74 |
})
75 |
}
76 |
});
77 |
78 |
79 |
80 |
81 |
82 | Pick a color scheme
83 | We can pick a color scheme from Color Chart .
84 |
85 |
86 |
87 |
...
88 |
options: {
89 |
plugins: {
90 |
colorschemes: {
91 |
scheme: 'brewer.Paired12 '
92 |
}
93 |
}
94 |
}
95 |
96 |
97 |
98 | Color Scheme:
99 | Number of Datasets:
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 | ...and you're done!
117 | See also GitHub repository and Color Chart
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
317 |
330 |
339 |
340 |
341 |
--------------------------------------------------------------------------------
/docs/ja/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | chartjs-plugin-colorschemes
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | chartjs-plugin-colorschemes
22 |
23 | English
24 |
25 |
26 | Chart.js 向けの定義済みカラーパレットプラグインです。 データビジュアライゼーションに最適なカラーセットを豊富に揃えました。
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | スクリプトを含める
36 | まず Chart.js 、chartjs-plugin-colorschemes.js をページに含める必要があります。
37 |
38 |
39 |
40 |
<script type="text/javascript" src="Chart.js"></script>
41 |
<script type="text/javascript" src="chartjs-plugin-colorschemes.js"></script>
42 |
43 |
44 |
45 |
46 |
47 | Create を作成する
48 | ページに Canvas を設置します。
49 |
50 |
51 |
52 |
<canvas id="myChart"></canvas>
53 |
54 |
55 |
56 |
57 |
58 | チャートを作成する
59 | これでチャートを作成することができます。スクリプトをページに追加します。 この例では、ランダムな数値のデータセットを生成しています。
60 |
61 |
62 |
63 |
var ctx = document.getElementById('myChart').getContext('2d');
64 |
var chart = new Chart(ctx, {
65 |
type: 'line',
66 |
data: {
67 |
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
68 |
datasets: [1, 2, 3].map(function(i) {
69 |
return {
70 |
label: 'Dataset ' + i,
71 |
data: [0, 0, 0, 0, 0, 0, 0].map(Math.random),
72 |
fill: false
73 |
};
74 |
})
75 |
}
76 |
});
77 |
78 |
79 |
80 |
81 |
82 | カラースキームを選ぶ
83 | カラーチャート から好きなカラースキームを選びます。
84 |
85 |
86 |
87 |
...
88 |
options: {
89 |
plugins: {
90 |
colorschemes: {
91 |
scheme: 'brewer.Paired12 '
92 |
}
93 |
}
94 |
}
95 |
96 |
97 |
98 | カラースキーム:
99 | データセット数:
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 | ...これで完了です!
117 | GitHub リポジトリ とカラーチャート もご覧ください。
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
317 |
330 |
339 |
340 |
341 |
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | /* global Promise */
2 |
3 | var gulp = require('gulp');
4 | var eslint = require('gulp-eslint');
5 | var file = require('gulp-file');
6 | var replace = require('gulp-replace');
7 | var streamify = require('gulp-streamify');
8 | var zip = require('gulp-zip');
9 | var karma = require('karma');
10 | var merge = require('merge2');
11 | var path = require('path');
12 | var {exec} = require('child_process');
13 | var pkg = require('./package.json');
14 |
15 | var argv = require('yargs')
16 | .option('output', {alias: 'o', default: 'dist'})
17 | .option('samples-dir', {default: 'samples'})
18 | .option('docs-dir', {default: 'docs'})
19 | .argv;
20 |
21 | function run(bin, args) {
22 | return new Promise((resolve, reject) => {
23 | var exe = '"' + process.execPath + '"';
24 | var src = require.resolve(bin);
25 | var ps = exec([exe, src].concat(args || []).join(' '));
26 |
27 | ps.stdout.pipe(process.stdout);
28 | ps.stderr.pipe(process.stderr);
29 | ps.on('close', (error) => {
30 | if (error) {
31 | reject(error);
32 | } else {
33 | resolve();
34 | }
35 | });
36 | });
37 | }
38 |
39 | gulp.task('build', function() {
40 | return run('rollup/dist/bin/rollup', ['-c', argv.watch ? '--watch' : '']);
41 | });
42 |
43 | gulp.task('test', function(done) {
44 | new karma.Server({
45 | configFile: path.join(__dirname, 'karma.config.js'),
46 | singleRun: !argv.watch,
47 | args: {
48 | coverage: !!argv.coverage,
49 | inputs: (argv.inputs || 'test/specs/**/*.js').split(';'),
50 | watch: argv.watch
51 | }
52 | },
53 | function(error) {
54 | // https://github.com/karma-runner/gulp-karma/issues/18
55 | error = error ? new Error('Karma returned with the error code: ' + error) : undefined;
56 | done(error);
57 | }).start();
58 | });
59 |
60 | gulp.task('lint', function() {
61 | var files = [
62 | 'docs/**/*.html',
63 | 'samples/**/*.html',
64 | 'src/**/*.js',
65 | 'test/**/*.js',
66 | '*.js'
67 | ];
68 |
69 | var options = {
70 | rules: {
71 | complexity: [1, 10],
72 | 'max-statements': [1, 30]
73 | }
74 | };
75 |
76 | return gulp.src(files)
77 | .pipe(eslint(options))
78 | .pipe(eslint.format())
79 | .pipe(eslint.failAfterError());
80 | });
81 |
82 | gulp.task('samples', function() {
83 | // since we moved the dist files one folder up (package root), we need to rewrite
84 | // samples src="../dist/ to src="../ and then copy them in the /samples directory.
85 | var out = path.join(argv.output, argv.samplesDir);
86 | return gulp.src('samples/**/*', {base: 'samples'})
87 | .pipe(streamify(replace(/src="((?:\.\.\/)+)dist\//g, 'src="$1', {skipBinary: true})))
88 | .pipe(gulp.dest(out));
89 | });
90 |
91 | gulp.task('package', gulp.series(gulp.parallel('build', 'samples'), function() {
92 | var out = argv.output;
93 | var streams = merge(
94 | gulp.src(path.join(out, argv.samplesDir, '**/*'), {base: out}),
95 | gulp.src([path.join(out, '*.js'), 'LICENSE.md'])
96 | );
97 |
98 | return streams
99 | .pipe(zip(pkg.name + '.zip'))
100 | .pipe(gulp.dest(out));
101 | }));
102 |
103 | gulp.task('bower', function() {
104 | var json = JSON.stringify({
105 | name: pkg.name,
106 | description: pkg.description,
107 | homepage: pkg.homepage,
108 | license: pkg.license,
109 | version: pkg.version,
110 | main: argv.output + '/' + pkg.name + '.js',
111 | ignore: [
112 | '.codeclimate.yml',
113 | '.gitignore',
114 | '.npmignore',
115 | '.travis.yml',
116 | 'scripts'
117 | ]
118 | }, null, 2);
119 |
120 | return file('bower.json', json, {src: true})
121 | .pipe(gulp.dest('./'));
122 | });
123 |
124 | gulp.task('default', gulp.parallel('build'));
125 |
--------------------------------------------------------------------------------
/karma.config.js:
--------------------------------------------------------------------------------
1 | const commonjs = require('rollup-plugin-commonjs');
2 | const istanbul = require('rollup-plugin-istanbul');
3 | const resolve = require('rollup-plugin-node-resolve');
4 | const builds = require('./rollup.config');
5 |
6 | module.exports = function(karma) {
7 | const args = karma.args || {};
8 | const regex = args.watch ? /\.js$/ : /\.min\.js$/;
9 | const build = builds.filter((v) => v.output.file.match(regex))[0];
10 |
11 | if (args.watch) {
12 | build.output.sourcemap = 'inline';
13 | }
14 |
15 | karma.set({
16 | browsers: ['firefox'],
17 | frameworks: ['jasmine'],
18 | reporters: ['spec', 'kjhtml'],
19 | logLevel: karma.LOG_WARN,
20 |
21 | files: [
22 | {pattern: 'test/fixtures/**/*.js', included: false},
23 | {pattern: 'test/fixtures/**/*.png', included: false},
24 | 'node_modules/chart.js/dist/Chart.js',
25 | 'test/index.js',
26 | 'src/index.js'
27 | ].concat(args.inputs),
28 |
29 | // Explicitly disable hardware acceleration to make image
30 | // diff more stable when ran on Travis and dev machine.
31 | // https://github.com/chartjs/Chart.js/pull/5629
32 | customLaunchers: {
33 | firefox: {
34 | base: 'Firefox',
35 | prefs: {
36 | 'layers.acceleration.disabled': true
37 | }
38 | }
39 | },
40 |
41 | preprocessors: {
42 | 'test/fixtures/**/*.js': ['fixtures'],
43 | 'test/specs/**/*.js': ['rollup'],
44 | 'test/index.js': ['rollup'],
45 | 'src/index.js': ['sources']
46 | },
47 |
48 | rollupPreprocessor: {
49 | plugins: [
50 | resolve(),
51 | commonjs()
52 | ],
53 | external: [
54 | 'chart.js'
55 | ],
56 | output: {
57 | name: 'test',
58 | format: 'umd',
59 | globals: {
60 | 'chart.js': 'Chart'
61 | }
62 | }
63 | },
64 |
65 | customPreprocessors: {
66 | fixtures: {
67 | base: 'rollup',
68 | options: {
69 | output: {
70 | format: 'iife',
71 | name: 'fixture'
72 | }
73 | }
74 | },
75 | sources: {
76 | base: 'rollup',
77 | options: build
78 | }
79 | }
80 | });
81 |
82 | if (args.coverage) {
83 | karma.reporters.push('coverage');
84 | karma.coverageReporter = {
85 | dir: 'coverage/',
86 | reporters: [
87 | {type: 'html', subdir: 'html'},
88 | {type: 'lcovonly', subdir: '.'}
89 | ]
90 | };
91 | [
92 | karma.rollupPreprocessor,
93 | karma.customPreprocessors.sources.options
94 | ].forEach((v) => {
95 | (v.plugins || (v.plugins = [])).push(
96 | istanbul({
97 | include: 'src/**/*.js'
98 | }));
99 | });
100 | }
101 | };
102 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "chartjs-plugin-colorschemes",
3 | "homepage": "https://nagix.github.io/chartjs-plugin-colorschemes",
4 | "description": "Predefined color schemes for Chart.js",
5 | "author": "Akihiko Kusanagi (https://nagix.github.io/)",
6 | "version": "0.4.0",
7 | "license": "MIT",
8 | "jsdelivr": "dist/chartjs-plugin-colorschemes.min.js",
9 | "unpkg": "dist/chartjs-plugin-colorschemes.min.js",
10 | "main": "dist/chartjs-plugin-colorschemes.js",
11 | "repository": {
12 | "type": "git",
13 | "url": "https://github.com/nagix/chartjs-plugin-colorschemes.git"
14 | },
15 | "bugs": {
16 | "url": "https://github.com/nagix/chartjs-plugin-colorschemes/issues"
17 | },
18 | "keywords": [
19 | "chart.js",
20 | "plugin",
21 | "color",
22 | "scheme",
23 | "palette",
24 | "brewer",
25 | "office",
26 | "tableau"
27 | ],
28 | "files": [
29 | "bower.json",
30 | "dist/*.js",
31 | "src/"
32 | ],
33 | "directories": {
34 | "doc": "docs",
35 | "test": "test"
36 | },
37 | "devDependencies": {
38 | "chart.js": "~2.8.0",
39 | "eslint-config-chartjs": "^0.1.0",
40 | "eslint-plugin-es": "^1.4.0",
41 | "eslint-plugin-html": "^5.0.3",
42 | "gulp": "^4.0.0",
43 | "gulp-eslint": "^5.0.0",
44 | "gulp-file": "^0.4.0",
45 | "gulp-replace": "^1.0.0",
46 | "gulp-streamify": "^1.0.2",
47 | "gulp-zip": "^4.2.0",
48 | "jasmine-core": "^3.4.0",
49 | "karma": "^4.1.0",
50 | "karma-coverage": "^1.1.2",
51 | "karma-firefox-launcher": "^1.1.0",
52 | "karma-jasmine": "^2.0.1",
53 | "karma-jasmine-html-reporter": "^1.4.2",
54 | "karma-rollup-preprocessor": "^7.0.0",
55 | "karma-spec-reporter": "^0.0.32",
56 | "merge2": "^1.2.3",
57 | "pixelmatch": "^4.0.2",
58 | "rollup": "^1.11.2",
59 | "rollup-plugin-commonjs": "^9.3.4",
60 | "rollup-plugin-istanbul": "^2.0.1",
61 | "rollup-plugin-node-resolve": "^4.2.3",
62 | "rollup-plugin-terser": "^4.0.4",
63 | "yargs": "^13.2.2"
64 | },
65 | "peerDependencies": {
66 | "chart.js": ">= 2.5.0 < 3"
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/rollup.config.js:
--------------------------------------------------------------------------------
1 | const terser = require('rollup-plugin-terser').terser;
2 | const pkg = require('./package.json');
3 |
4 | const banner = `/*!
5 | * ${pkg.name} v${pkg.version}
6 | * ${pkg.homepage}
7 | * (c) ${new Date().getFullYear()} Akihiko Kusanagi
8 | * Released under the ${pkg.license} license
9 | */`;
10 |
11 | module.exports = [
12 | {
13 | input: 'src/index.js',
14 | output: {
15 | name: 'ChartColorSchemes',
16 | file: `dist/${pkg.name}.js`,
17 | banner: banner,
18 | format: 'umd',
19 | indent: false,
20 | globals: {
21 | 'chart.js': 'Chart'
22 | }
23 | },
24 | external: [
25 | 'chart.js'
26 | ]
27 | },
28 | {
29 | input: 'src/index.js',
30 | output: {
31 | name: 'ChartColorSchemes',
32 | file: `dist/${pkg.name}.min.js`,
33 | format: 'umd',
34 | indent: false,
35 | globals: {
36 | 'chart.js': 'Chart'
37 | }
38 | },
39 | plugins: [
40 | terser({
41 | output: {
42 | preamble: banner
43 | }
44 | })
45 | ],
46 | external: [
47 | 'chart.js'
48 | ]
49 | }
50 | ];
51 |
--------------------------------------------------------------------------------
/samples/.eslintrc.yml:
--------------------------------------------------------------------------------
1 | plugins: [es, html]
2 |
3 | extends: [
4 | plugin:es/no-2018,
5 | plugin:es/no-2017,
6 | plugin:es/no-2016,
7 | plugin:es/no-2015
8 | ]
9 |
10 | globals:
11 | Chart: true
12 | XLSX: true
13 | ChartDataSource: true
14 |
15 | parserOptions:
16 | sourceType: script
17 |
18 | rules:
19 | no-unused-vars: 0
20 |
--------------------------------------------------------------------------------
/samples/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | chartjs-plugin-colorschemes sample
7 |
8 |
9 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | Randomize Data
32 | Add Dataset
33 | Remove Dataset
34 | Add Data
35 | Remove Data
36 |
37 |
38 | Color Scheme:
39 |
40 | Background:
41 |
42 | White
43 | Black
44 |
45 |
46 |
47 |
48 |
206 |
207 |
208 |
209 |
--------------------------------------------------------------------------------
/scripts/release.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | if [ "$TRAVIS_BRANCH" != "release" ]; then
6 | echo "Skipping release because this is not the 'release' branch"
7 | exit 0
8 | fi
9 |
10 | # Travis executes this script from the repository root, so at the same level than package.json
11 | VERSION=$(node -p -e "require('./package.json').version")
12 |
13 | # Make sure that the associated tag doesn't already exist
14 | GITTAG=$(git ls-remote origin refs/tags/v$VERSION)
15 | if [ "$GITTAG" != "" ]; then
16 | echo "Tag for package.json version already exists, aborting release"
17 | exit 1
18 | fi
19 |
20 | git remote add auth-origin https://$GITHUB_AUTH_TOKEN@github.com/$TRAVIS_REPO_SLUG.git
21 | git config --global user.email "$GITHUB_AUTH_EMAIL"
22 | git config --global user.name "nagix"
23 | git checkout --detach --quiet
24 | git add -f dist/*.js bower.json
25 | git commit -m "Release $VERSION"
26 | git tag -a "v$VERSION" -m "Version $VERSION"
27 | git push -q auth-origin refs/tags/v$VERSION 2>/dev/null
28 | git remote rm auth-origin
29 | git checkout -f @{-1}
30 |
--------------------------------------------------------------------------------
/src/colorschemes/colorschemes.brewer.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | // eslint-disable-next-line one-var
4 | export var
5 | // Sequential
6 | YlGn3 = ['#f7fcb9', '#addd8e', '#31a354'],
7 | YlGn4 = ['#ffffcc', '#c2e699', '#78c679', '#238443'],
8 | YlGn5 = ['#ffffcc', '#c2e699', '#78c679', '#31a354', '#006837'],
9 | YlGn6 = ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#31a354', '#006837'],
10 | YlGn7 = ['#ffffcc', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#005a32'],
11 | YlGn8 = ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#005a32'],
12 | YlGn9 = ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#006837', '#004529'],
13 |
14 | YlGnBu3 = ['#edf8b1', '#7fcdbb', '#2c7fb8'],
15 | YlGnBu4 = ['#ffffcc', '#a1dab4', '#41b6c4', '#225ea8'],
16 | YlGnBu5 = ['#ffffcc', '#a1dab4', '#41b6c4', '#2c7fb8', '#253494'],
17 | YlGnBu6 = ['#ffffcc', '#c7e9b4', '#7fcdbb', '#41b6c4', '#2c7fb8', '#253494'],
18 | YlGnBu7 = ['#ffffcc', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#0c2c84'],
19 | YlGnBu8 = ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#0c2c84'],
20 | YlGnBu9 = ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58'],
21 |
22 | GnBu3 = ['#e0f3db', '#a8ddb5', '#43a2ca'],
23 | GnBu4 = ['#f0f9e8', '#bae4bc', '#7bccc4', '#2b8cbe'],
24 | GnBu5 = ['#f0f9e8', '#bae4bc', '#7bccc4', '#43a2ca', '#0868ac'],
25 | GnBu6 = ['#f0f9e8', '#ccebc5', '#a8ddb5', '#7bccc4', '#43a2ca', '#0868ac'],
26 | GnBu7 = ['#f0f9e8', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#08589e'],
27 | GnBu8 = ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#08589e'],
28 | GnBu9 = ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081'],
29 |
30 | BuGn3 = ['#e5f5f9', '#99d8c9', '#2ca25f'],
31 | BuGn4 = ['#edf8fb', '#b2e2e2', '#66c2a4', '#238b45'],
32 | BuGn5 = ['#edf8fb', '#b2e2e2', '#66c2a4', '#2ca25f', '#006d2c'],
33 | BuGn6 = ['#edf8fb', '#ccece6', '#99d8c9', '#66c2a4', '#2ca25f', '#006d2c'],
34 | BuGn7 = ['#edf8fb', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#005824'],
35 | BuGn8 = ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#005824'],
36 | BuGn9 = ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#006d2c', '#00441b'],
37 |
38 | PuBuGn3 = ['#ece2f0', '#a6bddb', '#1c9099'],
39 | PuBuGn4 = ['#f6eff7', '#bdc9e1', '#67a9cf', '#02818a'],
40 | PuBuGn5 = ['#f6eff7', '#bdc9e1', '#67a9cf', '#1c9099', '#016c59'],
41 | PuBuGn6 = ['#f6eff7', '#d0d1e6', '#a6bddb', '#67a9cf', '#1c9099', '#016c59'],
42 | PuBuGn7 = ['#f6eff7', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016450'],
43 | PuBuGn8 = ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016450'],
44 | PuBuGn9 = ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016c59', '#014636'],
45 |
46 | PuBu3 = ['#ece7f2', '#a6bddb', '#2b8cbe'],
47 | PuBu4 = ['#f1eef6', '#bdc9e1', '#74a9cf', '#0570b0'],
48 | PuBu5 = ['#f1eef6', '#bdc9e1', '#74a9cf', '#2b8cbe', '#045a8d'],
49 | PuBu6 = ['#f1eef6', '#d0d1e6', '#a6bddb', '#74a9cf', '#2b8cbe', '#045a8d'],
50 | PuBu7 = ['#f1eef6', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#034e7b'],
51 | PuBu8 = ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#034e7b'],
52 | PuBu9 = ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#045a8d', '#023858'],
53 |
54 | BuPu3 = ['#e0ecf4', '#9ebcda', '#8856a7'],
55 | BuPu4 = ['#edf8fb', '#b3cde3', '#8c96c6', '#88419d'],
56 | BuPu5 = ['#edf8fb', '#b3cde3', '#8c96c6', '#8856a7', '#810f7c'],
57 | BuPu6 = ['#edf8fb', '#bfd3e6', '#9ebcda', '#8c96c6', '#8856a7', '#810f7c'],
58 | BuPu7 = ['#edf8fb', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#6e016b'],
59 | BuPu8 = ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#6e016b'],
60 | BuPu9 = ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#810f7c', '#4d004b'],
61 |
62 | RdPu3 = ['#fde0dd', '#fa9fb5', '#c51b8a'],
63 | RdPu4 = ['#feebe2', '#fbb4b9', '#f768a1', '#ae017e'],
64 | RdPu5 = ['#feebe2', '#fbb4b9', '#f768a1', '#c51b8a', '#7a0177'],
65 | RdPu6 = ['#feebe2', '#fcc5c0', '#fa9fb5', '#f768a1', '#c51b8a', '#7a0177'],
66 | RdPu7 = ['#feebe2', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177'],
67 | RdPu8 = ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177'],
68 | RdPu9 = ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177', '#49006a'],
69 |
70 | PuRd3 = ['#e7e1ef', '#c994c7', '#dd1c77'],
71 | PuRd4 = ['#f1eef6', '#d7b5d8', '#df65b0', '#ce1256'],
72 | PuRd5 = ['#f1eef6', '#d7b5d8', '#df65b0', '#dd1c77', '#980043'],
73 | PuRd6 = ['#f1eef6', '#d4b9da', '#c994c7', '#df65b0', '#dd1c77', '#980043'],
74 | PuRd7 = ['#f1eef6', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#91003f'],
75 | PuRd8 = ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#91003f'],
76 | PuRd9 = ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#980043', '#67001f'],
77 |
78 | OrRd3 = ['#fee8c8', '#fdbb84', '#e34a33'],
79 | OrRd4 = ['#fef0d9', '#fdcc8a', '#fc8d59', '#d7301f'],
80 | OrRd5 = ['#fef0d9', '#fdcc8a', '#fc8d59', '#e34a33', '#b30000'],
81 | OrRd6 = ['#fef0d9', '#fdd49e', '#fdbb84', '#fc8d59', '#e34a33', '#b30000'],
82 | OrRd7 = ['#fef0d9', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#990000'],
83 | OrRd8 = ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#990000'],
84 | OrRd9 = ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#b30000', '#7f0000'],
85 |
86 | YlOrRd3 = ['#ffeda0', '#feb24c', '#f03b20'],
87 | YlOrRd4 = ['#ffffb2', '#fecc5c', '#fd8d3c', '#e31a1c'],
88 | YlOrRd5 = ['#ffffb2', '#fecc5c', '#fd8d3c', '#f03b20', '#bd0026'],
89 | YlOrRd6 = ['#ffffb2', '#fed976', '#feb24c', '#fd8d3c', '#f03b20', '#bd0026'],
90 | YlOrRd7 = ['#ffffb2', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#b10026'],
91 | YlOrRd8 = ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#b10026'],
92 | YlOrRd9 = ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026'],
93 |
94 | YlOrBr3 = ['#fff7bc', '#fec44f', '#d95f0e'],
95 | YlOrBr4 = ['#ffffd4', '#fed98e', '#fe9929', '#cc4c02'],
96 | YlOrBr5 = ['#ffffd4', '#fed98e', '#fe9929', '#d95f0e', '#993404'],
97 | YlOrBr6 = ['#ffffd4', '#fee391', '#fec44f', '#fe9929', '#d95f0e', '#993404'],
98 | YlOrBr7 = ['#ffffd4', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#8c2d04'],
99 | YlOrBr8 = ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#8c2d04'],
100 | YlOrBr9 = ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#993404', '#662506'],
101 |
102 | Purples3 = ['#efedf5', '#bcbddc', '#756bb1'],
103 | Purples4 = ['#f2f0f7', '#cbc9e2', '#9e9ac8', '#6a51a3'],
104 | Purples5 = ['#f2f0f7', '#cbc9e2', '#9e9ac8', '#756bb1', '#54278f'],
105 | Purples6 = ['#f2f0f7', '#dadaeb', '#bcbddc', '#9e9ac8', '#756bb1', '#54278f'],
106 | Purples7 = ['#f2f0f7', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#4a1486'],
107 | Purples8 = ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#4a1486'],
108 | Purples9 = ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#54278f', '#3f007d'],
109 |
110 | Blues3 = ['#deebf7', '#9ecae1', '#3182bd'],
111 | Blues4 = ['#eff3ff', '#bdd7e7', '#6baed6', '#2171b5'],
112 | Blues5 = ['#eff3ff', '#bdd7e7', '#6baed6', '#3182bd', '#08519c'],
113 | Blues6 = ['#eff3ff', '#c6dbef', '#9ecae1', '#6baed6', '#3182bd', '#08519c'],
114 | Blues7 = ['#eff3ff', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#084594'],
115 | Blues8 = ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#084594'],
116 | Blues9 = ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#08519c', '#08306b'],
117 |
118 | Greens3 = ['#e5f5e0', '#a1d99b', '#31a354'],
119 | Greens4 = ['#edf8e9', '#bae4b3', '#74c476', '#238b45'],
120 | Greens5 = ['#edf8e9', '#bae4b3', '#74c476', '#31a354', '#006d2c'],
121 | Greens6 = ['#edf8e9', '#c7e9c0', '#a1d99b', '#74c476', '#31a354', '#006d2c'],
122 | Greens7 = ['#edf8e9', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#005a32'],
123 | Greens8 = ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#005a32'],
124 | Greens9 = ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#006d2c', '#00441b'],
125 |
126 | Oranges3 = ['#fee6ce', '#fdae6b', '#e6550d'],
127 | Oranges4 = ['#feedde', '#fdbe85', '#fd8d3c', '#d94701'],
128 | Oranges5 = ['#feedde', '#fdbe85', '#fd8d3c', '#e6550d', '#a63603'],
129 | Oranges6 = ['#feedde', '#fdd0a2', '#fdae6b', '#fd8d3c', '#e6550d', '#a63603'],
130 | Oranges7 = ['#feedde', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#8c2d04'],
131 | Oranges8 = ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#8c2d04'],
132 | Oranges9 = ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'],
133 |
134 | Reds3 = ['#fee0d2', '#fc9272', '#de2d26'],
135 | Reds4 = ['#fee5d9', '#fcae91', '#fb6a4a', '#cb181d'],
136 | Reds5 = ['#fee5d9', '#fcae91', '#fb6a4a', '#de2d26', '#a50f15'],
137 | Reds6 = ['#fee5d9', '#fcbba1', '#fc9272', '#fb6a4a', '#de2d26', '#a50f15'],
138 | Reds7 = ['#fee5d9', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#99000d'],
139 | Reds8 = ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#99000d'],
140 | Reds9 = ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'],
141 |
142 | Greys3 = ['#f0f0f0', '#bdbdbd', '#636363'],
143 | Greys4 = ['#f7f7f7', '#cccccc', '#969696', '#525252'],
144 | Greys5 = ['#f7f7f7', '#cccccc', '#969696', '#636363', '#252525'],
145 | Greys6 = ['#f7f7f7', '#d9d9d9', '#bdbdbd', '#969696', '#636363', '#252525'],
146 | Greys7 = ['#f7f7f7', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525'],
147 | Greys8 = ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525'],
148 | Greys9 = ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525', '#000000'],
149 |
150 | // Diverging
151 | PuOr3 = ['#f1a340', '#f7f7f7', '#998ec3'],
152 | PuOr4 = ['#e66101', '#fdb863', '#b2abd2', '#5e3c99'],
153 | PuOr5 = ['#e66101', '#fdb863', '#f7f7f7', '#b2abd2', '#5e3c99'],
154 | PuOr6 = ['#b35806', '#f1a340', '#fee0b6', '#d8daeb', '#998ec3', '#542788'],
155 | PuOr7 = ['#b35806', '#f1a340', '#fee0b6', '#f7f7f7', '#d8daeb', '#998ec3', '#542788'],
156 | PuOr8 = ['#b35806', '#e08214', '#fdb863', '#fee0b6', '#d8daeb', '#b2abd2', '#8073ac', '#542788'],
157 | PuOr9 = ['#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788'],
158 | PuOr10 = ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'],
159 | PuOr11 = ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'],
160 |
161 | BrBG3 = ['#d8b365', '#f5f5f5', '#5ab4ac'],
162 | BrBG4 = ['#a6611a', '#dfc27d', '#80cdc1', '#018571'],
163 | BrBG5 = ['#a6611a', '#dfc27d', '#f5f5f5', '#80cdc1', '#018571'],
164 | BrBG6 = ['#8c510a', '#d8b365', '#f6e8c3', '#c7eae5', '#5ab4ac', '#01665e'],
165 | BrBG7 = ['#8c510a', '#d8b365', '#f6e8c3', '#f5f5f5', '#c7eae5', '#5ab4ac', '#01665e'],
166 | BrBG8 = ['#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#c7eae5', '#80cdc1', '#35978f', '#01665e'],
167 | BrBG9 = ['#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e'],
168 | BrBG10 = ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'],
169 | BrBG11 = ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'],
170 |
171 | PRGn3 = ['#af8dc3', '#f7f7f7', '#7fbf7b'],
172 | PRGn4 = ['#7b3294', '#c2a5cf', '#a6dba0', '#008837'],
173 | PRGn5 = ['#7b3294', '#c2a5cf', '#f7f7f7', '#a6dba0', '#008837'],
174 | PRGn6 = ['#762a83', '#af8dc3', '#e7d4e8', '#d9f0d3', '#7fbf7b', '#1b7837'],
175 | PRGn7 = ['#762a83', '#af8dc3', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#7fbf7b', '#1b7837'],
176 | PRGn8 = ['#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837'],
177 | PRGn9 = ['#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837'],
178 | PRGn10 = ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'],
179 | PRGn11 = ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'],
180 |
181 | PiYG3 = ['#e9a3c9', '#f7f7f7', '#a1d76a'],
182 | PiYG4 = ['#d01c8b', '#f1b6da', '#b8e186', '#4dac26'],
183 | PiYG5 = ['#d01c8b', '#f1b6da', '#f7f7f7', '#b8e186', '#4dac26'],
184 | PiYG6 = ['#c51b7d', '#e9a3c9', '#fde0ef', '#e6f5d0', '#a1d76a', '#4d9221'],
185 | PiYG7 = ['#c51b7d', '#e9a3c9', '#fde0ef', '#f7f7f7', '#e6f5d0', '#a1d76a', '#4d9221'],
186 | PiYG8 = ['#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221'],
187 | PiYG9 = ['#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221'],
188 | PiYG10 = ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'],
189 | PiYG11 = ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'],
190 |
191 | RdBu3 = ['#ef8a62', '#f7f7f7', '#67a9cf'],
192 | RdBu4 = ['#ca0020', '#f4a582', '#92c5de', '#0571b0'],
193 | RdBu5 = ['#ca0020', '#f4a582', '#f7f7f7', '#92c5de', '#0571b0'],
194 | RdBu6 = ['#b2182b', '#ef8a62', '#fddbc7', '#d1e5f0', '#67a9cf', '#2166ac'],
195 | RdBu7 = ['#b2182b', '#ef8a62', '#fddbc7', '#f7f7f7', '#d1e5f0', '#67a9cf', '#2166ac'],
196 | RdBu8 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac'],
197 | RdBu9 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac'],
198 | RdBu10 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'],
199 | RdBu11 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'],
200 |
201 | RdGy3 = ['#ef8a62', '#ffffff', '#999999'],
202 | RdGy4 = ['#ca0020', '#f4a582', '#bababa', '#404040'],
203 | RdGy5 = ['#ca0020', '#f4a582', '#ffffff', '#bababa', '#404040'],
204 | RdGy6 = ['#b2182b', '#ef8a62', '#fddbc7', '#e0e0e0', '#999999', '#4d4d4d'],
205 | RdGy7 = ['#b2182b', '#ef8a62', '#fddbc7', '#ffffff', '#e0e0e0', '#999999', '#4d4d4d'],
206 | RdGy8 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#e0e0e0', '#bababa', '#878787', '#4d4d4d'],
207 | RdGy9 = ['#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d'],
208 | RdGy10 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'],
209 | RdGy11 = ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'],
210 |
211 | RdYlBu3 = ['#fc8d59', '#ffffbf', '#91bfdb'],
212 | RdYlBu4 = ['#d7191c', '#fdae61', '#abd9e9', '#2c7bb6'],
213 | RdYlBu5 = ['#d7191c', '#fdae61', '#ffffbf', '#abd9e9', '#2c7bb6'],
214 | RdYlBu6 = ['#d73027', '#fc8d59', '#fee090', '#e0f3f8', '#91bfdb', '#4575b4'],
215 | RdYlBu7 = ['#d73027', '#fc8d59', '#fee090', '#ffffbf', '#e0f3f8', '#91bfdb', '#4575b4'],
216 | RdYlBu8 = ['#d73027', '#f46d43', '#fdae61', '#fee090', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4'],
217 | RdYlBu9 = ['#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4'],
218 | RdYlBu10 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'],
219 | RdYlBu11 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'],
220 |
221 | Spectral3 = ['#fc8d59', '#ffffbf', '#99d594'],
222 | Spectral4 = ['#d7191c', '#fdae61', '#abdda4', '#2b83ba'],
223 | Spectral5 = ['#d7191c', '#fdae61', '#ffffbf', '#abdda4', '#2b83ba'],
224 | Spectral6 = ['#d53e4f', '#fc8d59', '#fee08b', '#e6f598', '#99d594', '#3288bd'],
225 | Spectral7 = ['#d53e4f', '#fc8d59', '#fee08b', '#ffffbf', '#e6f598', '#99d594', '#3288bd'],
226 | Spectral8 = ['#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#e6f598', '#abdda4', '#66c2a5', '#3288bd'],
227 | Spectral9 = ['#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd'],
228 | Spectral10 = ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'],
229 | Spectral11 = ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'],
230 |
231 | RdYlGn3 = ['#fc8d59', '#ffffbf', '#91cf60'],
232 | RdYlGn4 = ['#d7191c', '#fdae61', '#a6d96a', '#1a9641'],
233 | RdYlGn5 = ['#d7191c', '#fdae61', '#ffffbf', '#a6d96a', '#1a9641'],
234 | RdYlGn6 = ['#d73027', '#fc8d59', '#fee08b', '#d9ef8b', '#91cf60', '#1a9850'],
235 | RdYlGn7 = ['#d73027', '#fc8d59', '#fee08b', '#ffffbf', '#d9ef8b', '#91cf60', '#1a9850'],
236 | RdYlGn8 = ['#d73027', '#f46d43', '#fdae61', '#fee08b', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850'],
237 | RdYlGn9 = ['#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850'],
238 | RdYlGn10 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'],
239 | RdYlGn11 = ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'],
240 |
241 | // Qualitative
242 | Accent3 = ['#7fc97f', '#beaed4', '#fdc086'],
243 | Accent4 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99'],
244 | Accent5 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0'],
245 | Accent6 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f'],
246 | Accent7 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17'],
247 | Accent8 = ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17', '#666666'],
248 |
249 | DarkTwo3 = ['#1b9e77', '#d95f02', '#7570b3'],
250 | DarkTwo4 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a'],
251 | DarkTwo5 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e'],
252 | DarkTwo6 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02'],
253 | DarkTwo7 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d'],
254 | DarkTwo8 = ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d', '#666666'],
255 |
256 | Paired3 = ['#a6cee3', '#1f78b4', '#b2df8a'],
257 | Paired4 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c'],
258 | Paired5 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99'],
259 | Paired6 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c'],
260 | Paired7 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f'],
261 | Paired8 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00'],
262 | Paired9 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6'],
263 | Paired10 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a'],
264 | Paired11 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99'],
265 | Paired12 = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99', '#b15928'],
266 |
267 | PastelOne3 = ['#fbb4ae', '#b3cde3', '#ccebc5'],
268 | PastelOne4 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4'],
269 | PastelOne5 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6'],
270 | PastelOne6 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc'],
271 | PastelOne7 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd'],
272 | PastelOne8 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec'],
273 | PastelOne9 = ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec', '#f2f2f2'],
274 |
275 | PastelTwo3 = ['#b3e2cd', '#fdcdac', '#cbd5e8'],
276 | PastelTwo4 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4'],
277 | PastelTwo5 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9'],
278 | PastelTwo6 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae'],
279 | PastelTwo7 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc'],
280 | PastelTwo8 = ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc', '#cccccc'],
281 |
282 | SetOne3 = ['#e41a1c', '#377eb8', '#4daf4a'],
283 | SetOne4 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3'],
284 | SetOne5 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00'],
285 | SetOne6 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33'],
286 | SetOne7 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628'],
287 | SetOne8 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf'],
288 | SetOne9 = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf', '#999999'],
289 |
290 | SetTwo3 = ['#66c2a5', '#fc8d62', '#8da0cb'],
291 | SetTwo4 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3'],
292 | SetTwo5 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854'],
293 | SetTwo6 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f'],
294 | SetTwo7 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494'],
295 | SetTwo8 = ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494', '#b3b3b3'],
296 |
297 | SetThree3 = ['#8dd3c7', '#ffffb3', '#bebada'],
298 | SetThree4 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072'],
299 | SetThree5 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3'],
300 | SetThree6 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462'],
301 | SetThree7 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69'],
302 | SetThree8 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5'],
303 | SetThree9 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9'],
304 | SetThree10 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd'],
305 | SetThree11 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5'],
306 | SetThree12 = ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5', '#ffed6f'];
307 |
--------------------------------------------------------------------------------
/src/colorschemes/colorschemes.office.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | // eslint-disable-next-line one-var
4 | export var
5 | Adjacency6 = ['#a9a57c', '#9cbebd', '#d2cb6c', '#95a39d', '#c89f5d', '#b1a089'],
6 | Advantage6 = ['#663366', '#330f42', '#666699', '#999966', '#f7901e', '#a3a101'],
7 | Angles6 = ['#797b7e', '#f96a1b', '#08a1d9', '#7c984a', '#c2ad8d', '#506e94'],
8 | Apex6 = ['#ceb966', '#9cb084', '#6bb1c9', '#6585cf', '#7e6bc9', '#a379bb'],
9 | Apothecary6 = ['#93a299', '#cf543f', '#b5ae53', '#848058', '#e8b54d', '#786c71'],
10 | Aspect6 = ['#f07f09', '#9f2936', '#1b587c', '#4e8542', '#604878', '#c19859'],
11 | Atlas6 = ['#f81b02', '#fc7715', '#afbf41', '#50c49f', '#3b95c4', '#b560d4'],
12 | Austin6 = ['#94c600', '#71685a', '#ff6700', '#909465', '#956b43', '#fea022'],
13 | Badge6 = ['#f8b323', '#656a59', '#46b2b5', '#8caa7e', '#d36f68', '#826276'],
14 | Banded6 = ['#ffc000', '#a5d028', '#08cc78', '#f24099', '#828288', '#f56617'],
15 | Basis6 = ['#f09415', '#c1b56b', '#4baf73', '#5aa6c0', '#d17df9', '#fa7e5c'],
16 | Berlin6 = ['#a6b727', '#df5327', '#fe9e00', '#418ab3', '#d7d447', '#818183'],
17 | BlackTie6 = ['#6f6f74', '#a7b789', '#beae98', '#92a9b9', '#9c8265', '#8d6974'],
18 | Blue6 = ['#0f6fc6', '#009dd9', '#0bd0d9', '#10cf9b', '#7cca62', '#a5c249'],
19 | BlueGreen6 = ['#3494ba', '#58b6c0', '#75bda7', '#7a8c8e', '#84acb6', '#2683c6'],
20 | BlueII6 = ['#1cade4', '#2683c6', '#27ced7', '#42ba97', '#3e8853', '#62a39f'],
21 | BlueRed6 = ['#4a66ac', '#629dd1', '#297fd5', '#7f8fa9', '#5aa2ae', '#9d90a0'],
22 | BlueWarm6 = ['#4a66ac', '#629dd1', '#297fd5', '#7f8fa9', '#5aa2ae', '#9d90a0'],
23 | Breeze6 = ['#2c7c9f', '#244a58', '#e2751d', '#ffb400', '#7eb606', '#c00000'],
24 | Capital6 = ['#4b5a60', '#9c5238', '#504539', '#c1ad79', '#667559', '#bad6ad'],
25 | Celestial6 = ['#ac3ec1', '#477bd1', '#46b298', '#90ba4c', '#dd9d31', '#e25247'],
26 | Circuit6 = ['#9acd4c', '#faa93a', '#d35940', '#b258d3', '#63a0cc', '#8ac4a7'],
27 | Civic6 = ['#d16349', '#ccb400', '#8cadae', '#8c7b70', '#8fb08c', '#d19049'],
28 | Clarity6 = ['#93a299', '#ad8f67', '#726056', '#4c5a6a', '#808da0', '#79463d'],
29 | Codex6 = ['#990000', '#efab16', '#78ac35', '#35aca2', '#4083cf', '#0d335e'],
30 | Composite6 = ['#98c723', '#59b0b9', '#deae00', '#b77bb4', '#e0773c', '#a98d63'],
31 | Concourse6 = ['#2da2bf', '#da1f28', '#eb641b', '#39639d', '#474b78', '#7d3c4a'],
32 | Couture6 = ['#9e8e5c', '#a09781', '#85776d', '#aeafa9', '#8d878b', '#6b6149'],
33 | Crop6 = ['#8c8d86', '#e6c069', '#897b61', '#8dab8e', '#77a2bb', '#e28394'],
34 | Damask6 = ['#9ec544', '#50bea3', '#4a9ccc', '#9a66ca', '#c54f71', '#de9c3c'],
35 | Depth6 = ['#41aebd', '#97e9d5', '#a2cf49', '#608f3d', '#f4de3a', '#fcb11c'],
36 | Dividend6 = ['#4d1434', '#903163', '#b2324b', '#969fa7', '#66b1ce', '#40619d'],
37 | Droplet6 = ['#2fa3ee', '#4bcaad', '#86c157', '#d99c3f', '#ce6633', '#a35dd1'],
38 | Elemental6 = ['#629dd1', '#297fd5', '#7f8fa9', '#4a66ac', '#5aa2ae', '#9d90a0'],
39 | Equity6 = ['#d34817', '#9b2d1f', '#a28e6a', '#956251', '#918485', '#855d5d'],
40 | Essential6 = ['#7a7a7a', '#f5c201', '#526db0', '#989aac', '#dc5924', '#b4b392'],
41 | Excel16 = ['#9999ff', '#993366', '#ffffcc', '#ccffff', '#660066', '#ff8080', '#0066cc', '#ccccff', '#000080', '#ff00ff', '#ffff00', '#0000ff', '#800080', '#800000', '#008080', '#0000ff'],
42 | Executive6 = ['#6076b4', '#9c5252', '#e68422', '#846648', '#63891f', '#758085'],
43 | Exhibit6 = ['#3399ff', '#69ffff', '#ccff33', '#3333ff', '#9933ff', '#ff33ff'],
44 | Expo6 = ['#fbc01e', '#efe1a2', '#fa8716', '#be0204', '#640f10', '#7e13e3'],
45 | Facet6 = ['#90c226', '#54a021', '#e6b91e', '#e76618', '#c42f1a', '#918655'],
46 | Feathered6 = ['#606372', '#79a8a4', '#b2ad8f', '#ad8082', '#dec18c', '#92a185'],
47 | Flow6 = ['#0f6fc6', '#009dd9', '#0bd0d9', '#10cf9b', '#7cca62', '#a5c249'],
48 | Focus6 = ['#ffb91d', '#f97817', '#6de304', '#ff0000', '#732bea', '#c913ad'],
49 | Folio6 = ['#294171', '#748cbc', '#8e887c', '#834736', '#5a1705', '#a0a16a'],
50 | Formal6 = ['#907f76', '#a46645', '#cd9c47', '#9a92cd', '#7d639b', '#733678'],
51 | Forte6 = ['#c70f0c', '#dd6b0d', '#faa700', '#93e50d', '#17c7ba', '#0a96e4'],
52 | Foundry6 = ['#72a376', '#b0ccb0', '#a8cdd7', '#c0beaf', '#cec597', '#e8b7b7'],
53 | Frame6 = ['#40bad2', '#fab900', '#90bb23', '#ee7008', '#1ab39f', '#d5393d'],
54 | Gallery6 = ['#b71e42', '#de478e', '#bc72f0', '#795faf', '#586ea6', '#6892a0'],
55 | Genesis6 = ['#80b606', '#e29f1d', '#2397e2', '#35aca2', '#5430bb', '#8d34e0'],
56 | Grayscale6 = ['#dddddd', '#b2b2b2', '#969696', '#808080', '#5f5f5f', '#4d4d4d'],
57 | Green6 = ['#549e39', '#8ab833', '#c0cf3a', '#029676', '#4ab5c4', '#0989b1'],
58 | GreenYellow6 = ['#99cb38', '#63a537', '#37a76f', '#44c1a3', '#4eb3cf', '#51c3f9'],
59 | Grid6 = ['#c66951', '#bf974d', '#928b70', '#87706b', '#94734e', '#6f777d'],
60 | Habitat6 = ['#f8c000', '#f88600', '#f83500', '#8b723d', '#818b3d', '#586215'],
61 | Hardcover6 = ['#873624', '#d6862d', '#d0be40', '#877f6c', '#972109', '#aeb795'],
62 | Headlines6 = ['#439eb7', '#e28b55', '#dcb64d', '#4ca198', '#835b82', '#645135'],
63 | Horizon6 = ['#7e97ad', '#cc8e60', '#7a6a60', '#b4936d', '#67787b', '#9d936f'],
64 | Infusion6 = ['#8c73d0', '#c2e8c4', '#c5a6e8', '#b45ec7', '#9fdafb', '#95c5b0'],
65 | Inkwell6 = ['#860908', '#4a0505', '#7a500a', '#c47810', '#827752', '#b5bb83'],
66 | Inspiration6 = ['#749805', '#bacc82', '#6e9ec2', '#2046a5', '#5039c6', '#7411d0'],
67 | Integral6 = ['#1cade4', '#2683c6', '#27ced7', '#42ba97', '#3e8853', '#62a39f'],
68 | Ion6 = ['#b01513', '#ea6312', '#e6b729', '#6aac90', '#5f9c9d', '#9e5e9b'],
69 | IonBoardroom6 = ['#b31166', '#e33d6f', '#e45f3c', '#e9943a', '#9b6bf2', '#d53dd0'],
70 | Kilter6 = ['#76c5ef', '#fea022', '#ff6700', '#70a525', '#a5d848', '#20768c'],
71 | Madison6 = ['#a1d68b', '#5ec795', '#4dadcf', '#cdb756', '#e29c36', '#8ec0c1'],
72 | MainEvent6 = ['#b80e0f', '#a6987d', '#7f9a71', '#64969f', '#9b75b2', '#80737a'],
73 | Marquee6 = ['#418ab3', '#a6b727', '#f69200', '#838383', '#fec306', '#df5327'],
74 | Median6 = ['#94b6d2', '#dd8047', '#a5ab81', '#d8b25c', '#7ba79d', '#968c8c'],
75 | Mesh6 = ['#6f6f6f', '#bfbfa5', '#dcd084', '#e7bf5f', '#e9a039', '#cf7133'],
76 | Metail6 = ['#6283ad', '#324966', '#5b9ea4', '#1d5b57', '#1b4430', '#2f3c35'],
77 | Metro6 = ['#7fd13b', '#ea157a', '#feb80a', '#00addc', '#738ac8', '#1ab39f'],
78 | Metropolitan6 = ['#50b4c8', '#a8b97f', '#9b9256', '#657689', '#7a855d', '#84ac9d'],
79 | Module6 = ['#f0ad00', '#60b5cc', '#e66c7d', '#6bb76d', '#e88651', '#c64847'],
80 | NewsPrint6 = ['#ad0101', '#726056', '#ac956e', '#808da9', '#424e5b', '#730e00'],
81 | Office6 = ['#5b9bd5', '#ed7d31', '#a5a5a5', '#ffc000', '#4472c4', '#70ad47'],
82 | OfficeClassic6 = ['#4f81bd', '#c0504d', '#9bbb59', '#8064a2', '#4bacc6', '#f79646'],
83 | Opulent6 = ['#b83d68', '#ac66bb', '#de6c36', '#f9b639', '#cf6da4', '#fa8d3d'],
84 | Orange6 = ['#e48312', '#bd582c', '#865640', '#9b8357', '#c2bc80', '#94a088'],
85 | OrangeRed6 = ['#d34817', '#9b2d1f', '#a28e6a', '#956251', '#918485', '#855d5d'],
86 | Orbit6 = ['#f2d908', '#9de61e', '#0d8be6', '#c61b1b', '#e26f08', '#8d35d1'],
87 | Organic6 = ['#83992a', '#3c9770', '#44709d', '#a23c33', '#d97828', '#deb340'],
88 | Oriel6 = ['#fe8637', '#7598d9', '#b32c16', '#f5cd2d', '#aebad5', '#777c84'],
89 | Origin6 = ['#727ca3', '#9fb8cd', '#d2da7a', '#fada7a', '#b88472', '#8e736a'],
90 | Paper6 = ['#a5b592', '#f3a447', '#e7bc29', '#d092a7', '#9c85c0', '#809ec2'],
91 | Parallax6 = ['#30acec', '#80c34f', '#e29d3e', '#d64a3b', '#d64787', '#a666e1'],
92 | Parcel6 = ['#f6a21d', '#9bafb5', '#c96731', '#9ca383', '#87795d', '#a0988c'],
93 | Perception6 = ['#a2c816', '#e07602', '#e4c402', '#7dc1ef', '#21449b', '#a2b170'],
94 | Perspective6 = ['#838d9b', '#d2610c', '#80716a', '#94147c', '#5d5ad2', '#6f6c7d'],
95 | Pixel6 = ['#ff7f01', '#f1b015', '#fbec85', '#d2c2f1', '#da5af4', '#9d09d1'],
96 | Plaza6 = ['#990000', '#580101', '#e94a00', '#eb8f00', '#a4a4a4', '#666666'],
97 | Precedent6 = ['#993232', '#9b6c34', '#736c5d', '#c9972b', '#c95f2b', '#8f7a05'],
98 | Pushpin6 = ['#fda023', '#aa2b1e', '#71685c', '#64a73b', '#eb5605', '#b9ca1a'],
99 | Quotable6 = ['#00c6bb', '#6feba0', '#b6df5e', '#efb251', '#ef755f', '#ed515c'],
100 | Red6 = ['#a5300f', '#d55816', '#e19825', '#b19c7d', '#7f5f52', '#b27d49'],
101 | RedOrange6 = ['#e84c22', '#ffbd47', '#b64926', '#ff8427', '#cc9900', '#b22600'],
102 | RedViolet6 = ['#e32d91', '#c830cc', '#4ea6dc', '#4775e7', '#8971e1', '#d54773'],
103 | Retrospect6 = ['#e48312', '#bd582c', '#865640', '#9b8357', '#c2bc80', '#94a088'],
104 | Revolution6 = ['#0c5986', '#ddf53d', '#508709', '#bf5e00', '#9c0001', '#660075'],
105 | Saddle6 = ['#c6b178', '#9c5b14', '#71b2bc', '#78aa5d', '#867099', '#4c6f75'],
106 | Savon6 = ['#1cade4', '#2683c6', '#27ced7', '#42ba97', '#3e8853', '#62a39f'],
107 | Sketchbook6 = ['#a63212', '#e68230', '#9bb05e', '#6b9bc7', '#4e66b2', '#8976ac'],
108 | Sky6 = ['#073779', '#8fd9fb', '#ffcc00', '#eb6615', '#c76402', '#b523b4'],
109 | Slate6 = ['#bc451b', '#d3ba68', '#bb8640', '#ad9277', '#a55a43', '#ad9d7b'],
110 | Slice6 = ['#052f61', '#a50e82', '#14967c', '#6a9e1f', '#e87d37', '#c62324'],
111 | Slipstream6 = ['#4e67c8', '#5eccf3', '#a7ea52', '#5dceaf', '#ff8021', '#f14124'],
112 | SOHO6 = ['#61625e', '#964d2c', '#66553e', '#848058', '#afa14b', '#ad7d4d'],
113 | Solstice6 = ['#3891a7', '#feb80a', '#c32d2e', '#84aa33', '#964305', '#475a8d'],
114 | Spectrum6 = ['#990000', '#ff6600', '#ffba00', '#99cc00', '#528a02', '#333333'],
115 | Story6 = ['#1d86cd', '#732e9a', '#b50b1b', '#e8950e', '#55992b', '#2c9c89'],
116 | Studio6 = ['#f7901e', '#fec60b', '#9fe62f', '#4ea5d1', '#1c4596', '#542d90'],
117 | Summer6 = ['#51a6c2', '#51c2a9', '#7ec251', '#e1dc53', '#b54721', '#a16bb1'],
118 | Technic6 = ['#6ea0b0', '#ccaf0a', '#8d89a4', '#748560', '#9e9273', '#7e848d'],
119 | Thatch6 = ['#759aa5', '#cfc60d', '#99987f', '#90ac97', '#ffad1c', '#b9ab6f'],
120 | Tradition6 = ['#6b4a0b', '#790a14', '#908342', '#423e5c', '#641345', '#748a2f'],
121 | Travelogue6 = ['#b74d21', '#a32323', '#4576a3', '#615d9a', '#67924b', '#bf7b1b'],
122 | Trek6 = ['#f0a22e', '#a5644e', '#b58b80', '#c3986d', '#a19574', '#c17529'],
123 | Twilight6 = ['#e8bc4a', '#83c1c6', '#e78d35', '#909ce1', '#839c41', '#cc5439'],
124 | Urban6 = ['#53548a', '#438086', '#a04da3', '#c4652d', '#8b5d3d', '#5c92b5'],
125 | UrbanPop6 = ['#86ce24', '#00a2e6', '#fac810', '#7d8f8c', '#d06b20', '#958b8b'],
126 | VaporTrail6 = ['#df2e28', '#fe801a', '#e9bf35', '#81bb42', '#32c7a9', '#4a9bdc'],
127 | Venture6 = ['#9eb060', '#d09a08', '#f2ec86', '#824f1c', '#511818', '#553876'],
128 | Verve6 = ['#ff388c', '#e40059', '#9c007f', '#68007f', '#005bd3', '#00349e'],
129 | View6 = ['#6f6f74', '#92a9b9', '#a7b789', '#b9a489', '#8d6374', '#9b7362'],
130 | Violet6 = ['#ad84c6', '#8784c7', '#5d739a', '#6997af', '#84acb6', '#6f8183'],
131 | VioletII6 = ['#92278f', '#9b57d3', '#755dd9', '#665eb8', '#45a5ed', '#5982db'],
132 | Waveform6 = ['#31b6fd', '#4584d3', '#5bd078', '#a5d028', '#f5c040', '#05e0db'],
133 | Wisp6 = ['#a53010', '#de7e18', '#9f8351', '#728653', '#92aa4c', '#6aac91'],
134 | WoodType6 = ['#d34817', '#9b2d1f', '#a28e6a', '#956251', '#918485', '#855d5d'],
135 | Yellow6 = ['#ffca08', '#f8931d', '#ce8d3e', '#ec7016', '#e64823', '#9c6a6a'],
136 | YellowOrange6 = ['#f0a22e', '#a5644e', '#b58b80', '#c3986d', '#a19574', '#c17529'];
137 |
--------------------------------------------------------------------------------
/src/colorschemes/colorschemes.tableau.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | // eslint-disable-next-line one-var
4 | export var
5 | // New
6 | Tableau10 = ['#4E79A7', '#F28E2B', '#E15759', '#76B7B2', '#59A14F', '#EDC948', '#B07AA1', '#FF9DA7', '#9C755F', '#BAB0AC'],
7 | Tableau20 = ['#4E79A7', '#A0CBE8', '#F28E2B', '#FFBE7D', '#59A14F', '#8CD17D', '#B6992D', '#F1CE63', '#499894', '#86BCB6', '#E15759', '#FF9D9A', '#79706E', '#BAB0AC', '#D37295', '#FABFD2', '#B07AA1', '#D4A6C8', '#9D7660', '#D7B5A6'],
8 | ColorBlind10 = ['#1170aa', '#fc7d0b', '#a3acb9', '#57606c', '#5fa2ce', '#c85200', '#7b848f', '#a3cce9', '#ffbc79', '#c8d0d9'],
9 | SeattleGrays5 = ['#767f8b', '#b3b7b8', '#5c6068', '#d3d3d3', '#989ca3'],
10 | Traffic9 = ['#b60a1c', '#e39802', '#309143', '#e03531', '#f0bd27', '#51b364', '#ff684c', '#ffda66', '#8ace7e'],
11 | MillerStone11 = ['#4f6980', '#849db1', '#a2ceaa', '#638b66', '#bfbb60', '#f47942', '#fbb04e', '#b66353', '#d7ce9f', '#b9aa97', '#7e756d'],
12 | SuperfishelStone10 = ['#6388b4', '#ffae34', '#ef6f6a', '#8cc2ca', '#55ad89', '#c3bc3f', '#bb7693', '#baa094', '#a9b5ae', '#767676'],
13 | NurielStone9 = ['#8175aa', '#6fb899', '#31a1b3', '#ccb22b', '#a39fc9', '#94d0c0', '#959c9e', '#027b8e', '#9f8f12'],
14 | JewelBright9 = ['#eb1e2c', '#fd6f30', '#f9a729', '#f9d23c', '#5fbb68', '#64cdcc', '#91dcea', '#a4a4d5', '#bbc9e5'],
15 | Summer8 = ['#bfb202', '#b9ca5d', '#cf3e53', '#f1788d', '#00a2b3', '#97cfd0', '#f3a546', '#f7c480'],
16 | Winter10 = ['#90728f', '#b9a0b4', '#9d983d', '#cecb76', '#e15759', '#ff9888', '#6b6b6b', '#bab2ae', '#aa8780', '#dab6af'],
17 | GreenOrangeTeal12 = ['#4e9f50', '#87d180', '#ef8a0c', '#fcc66d', '#3ca8bc', '#98d9e4', '#94a323', '#c3ce3d', '#a08400', '#f7d42a', '#26897e', '#8dbfa8'],
18 | RedBlueBrown12 = ['#466f9d', '#91b3d7', '#ed444a', '#feb5a2', '#9d7660', '#d7b5a6', '#3896c4', '#a0d4ee', '#ba7e45', '#39b87f', '#c8133b', '#ea8783'],
19 | PurplePinkGray12 = ['#8074a8', '#c6c1f0', '#c46487', '#ffbed1', '#9c9290', '#c5bfbe', '#9b93c9', '#ddb5d5', '#7c7270', '#f498b6', '#b173a0', '#c799bc'],
20 | HueCircle19 = ['#1ba3c6', '#2cb5c0', '#30bcad', '#21B087', '#33a65c', '#57a337', '#a2b627', '#d5bb21', '#f8b620', '#f89217', '#f06719', '#e03426', '#f64971', '#fc719e', '#eb73b3', '#ce69be', '#a26dc2', '#7873c0', '#4f7cba'],
21 | OrangeBlue7 = ['#9e3d22', '#d45b21', '#f69035', '#d9d5c9', '#77acd3', '#4f81af', '#2b5c8a'],
22 | RedGreen7 = ['#a3123a', '#e33f43', '#f8816b', '#ced7c3', '#73ba67', '#44914e', '#24693d'],
23 | GreenBlue7 = ['#24693d', '#45934d', '#75bc69', '#c9dad2', '#77a9cf', '#4e7fab', '#2a5783'],
24 | RedBlue7 = ['#a90c38', '#e03b42', '#f87f69', '#dfd4d1', '#7eaed3', '#5383af', '#2e5a87'],
25 | RedBlack7 = ['#ae123a', '#e33e43', '#f8816b', '#d9d9d9', '#a0a7a8', '#707c83', '#49525e'],
26 | GoldPurple7 = ['#ad9024', '#c1a33b', '#d4b95e', '#e3d8cf', '#d4a3c3', '#c189b0', '#ac7299'],
27 | RedGreenGold7 = ['#be2a3e', '#e25f48', '#f88f4d', '#f4d166', '#90b960', '#4b9b5f', '#22763f'],
28 | SunsetSunrise7 = ['#33608c', '#9768a5', '#e7718a', '#f6ba57', '#ed7846', '#d54c45', '#b81840'],
29 | OrangeBlueWhite7 = ['#9e3d22', '#e36621', '#fcad52', '#ffffff', '#95c5e1', '#5b8fbc', '#2b5c8a'],
30 | RedGreenWhite7 = ['#ae123a', '#ee574d', '#fdac9e', '#ffffff', '#91d183', '#539e52', '#24693d'],
31 | GreenBlueWhite7 = ['#24693d', '#529c51', '#8fd180', '#ffffff', '#95c1dd', '#598ab5', '#2a5783'],
32 | RedBlueWhite7 = ['#a90c38', '#ec534b', '#feaa9a', '#ffffff', '#9ac4e1', '#5c8db8', '#2e5a87'],
33 | RedBlackWhite7 = ['#ae123a', '#ee574d', '#fdac9d', '#ffffff', '#bdc0bf', '#7d888d', '#49525e'],
34 | OrangeBlueLight7 = ['#ffcc9e', '#f9d4b6', '#f0dccd', '#e5e5e5', '#dae1ea', '#cfdcef', '#c4d8f3'],
35 | Temperature7 = ['#529985', '#6c9e6e', '#99b059', '#dbcf47', '#ebc24b', '#e3a14f', '#c26b51'],
36 | BlueGreen7 = ['#feffd9', '#f2fabf', '#dff3b2', '#c4eab1', '#94d6b7', '#69c5be', '#41b7c4'],
37 | BlueLight7 = ['#e5e5e5', '#e0e3e8', '#dbe1ea', '#d5dfec', '#d0dcef', '#cadaf1', '#c4d8f3'],
38 | OrangeLight7 = ['#e5e5e5', '#ebe1d9', '#f0ddcd', '#f5d9c2', '#f9d4b6', '#fdd0aa', '#ffcc9e'],
39 | Blue20 = ['#b9ddf1', '#afd6ed', '#a5cfe9', '#9bc7e4', '#92c0df', '#89b8da', '#80b0d5', '#79aacf', '#72a3c9', '#6a9bc3', '#6394be', '#5b8cb8', '#5485b2', '#4e7fac', '#4878a6', '#437a9f', '#3d6a98', '#376491', '#305d8a', '#2a5783'],
40 | Orange20 = ['#ffc685', '#fcbe75', '#f9b665', '#f7ae54', '#f5a645', '#f59c3c', '#f49234', '#f2882d', '#f07e27', '#ee7422', '#e96b20', '#e36420', '#db5e20', '#d25921', '#ca5422', '#c14f22', '#b84b23', '#af4623', '#a64122', '#9e3d22'],
41 | Green20 = ['#b3e0a6', '#a5db96', '#98d687', '#8ed07f', '#85ca77', '#7dc370', '#75bc69', '#6eb663', '#67af5c', '#61a956', '#59a253', '#519c51', '#49964f', '#428f4d', '#398949', '#308344', '#2b7c40', '#27763d', '#256f3d', '#24693d'],
42 | Red20 = ['#ffbeb2', '#feb4a6', '#fdab9b', '#fca290', '#fb9984', '#fa8f79', '#f9856e', '#f77b66', '#f5715d', '#f36754', '#f05c4d', '#ec5049', '#e74545', '#e13b42', '#da323f', '#d3293d', '#ca223c', '#c11a3b', '#b8163a', '#ae123a'],
43 | Purple20 = ['#eec9e5', '#eac1df', '#e6b9d9', '#e0b2d2', '#daabcb', '#d5a4c4', '#cf9dbe', '#ca96b8', '#c48fb2', '#be89ac', '#b882a6', '#b27ba1', '#aa759d', '#a27099', '#9a6a96', '#926591', '#8c5f86', '#865986', '#81537f', '#7c4d79'],
44 | Brown20 = ['#eedbbd', '#ecd2ad', '#ebc994', '#eac085', '#e8b777', '#e5ae6c', '#e2a562', '#de9d5a', '#d99455', '#d38c54', '#ce8451', '#c9784d', '#c47247', '#c16941', '#bd6036', '#b85636', '#b34d34', '#ad4433', '#a63d32', '#9f3632'],
45 | Gray20 = ['#d5d5d5', '#cdcecd', '#c5c7c6', '#bcbfbe', '#b4b7b7', '#acb0b1', '#a4a9ab', '#9ca3a4', '#939c9e', '#8b9598', '#848e93', '#7c878d', '#758087', '#6e7a81', '#67737c', '#616c77', '#5b6570', '#555f6a', '#4f5864', '#49525e'],
46 | GrayWarm20 = ['#dcd4d0', '#d4ccc8', '#cdc4c0', '#c5bdb9', '#beb6b2', '#b7afab', '#b0a7a4', '#a9a09d', '#a29996', '#9b938f', '#948c88', '#8d8481', '#867e7b', '#807774', '#79706e', '#736967', '#6c6260', '#665c51', '#5f5654', '#59504e'],
47 | BlueTeal20 = ['#bce4d8', '#aedcd5', '#a1d5d2', '#95cecf', '#89c8cc', '#7ec1ca', '#72bac6', '#66b2c2', '#59acbe', '#4ba5ba', '#419eb6', '#3b96b2', '#358ead', '#3586a7', '#347ea1', '#32779b', '#316f96', '#2f6790', '#2d608a', '#2c5985'],
48 | OrangeGold20 = ['#f4d166', '#f6c760', '#f8bc58', '#f8b252', '#f7a84a', '#f69e41', '#f49538', '#f38b2f', '#f28026', '#f0751e', '#eb6c1c', '#e4641e', '#de5d1f', '#d75521', '#cf4f22', '#c64a22', '#bc4623', '#b24223', '#a83e24', '#9e3a26'],
49 | GreenGold20 = ['#f4d166', '#e3cd62', '#d3c95f', '#c3c55d', '#b2c25b', '#a3bd5a', '#93b958', '#84b457', '#76af56', '#67a956', '#5aa355', '#4f9e53', '#479751', '#40914f', '#3a8a4d', '#34844a', '#2d7d45', '#257740', '#1c713b', '#146c36'],
50 | RedGold21 = ['#f4d166', '#f5c75f', '#f6bc58', '#f7b254', '#f9a750', '#fa9d4f', '#fa9d4f', '#fb934d', '#f7894b', '#f47f4a', '#f0774a', '#eb6349', '#e66549', '#e15c48', '#dc5447', '#d64c45', '#d04344', '#ca3a42', '#c43141', '#bd273f', '#b71d3e'],
51 |
52 | // Classic
53 | Classic10 = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'],
54 | ClassicMedium10 = ['#729ece', '#ff9e4a', '#67bf5c', '#ed665d', '#ad8bc9', '#a8786e', '#ed97ca', '#a2a2a2', '#cdcc5d', '#6dccda'],
55 | ClassicLight10 = ['#aec7e8', '#ffbb78', '#98df8a', '#ff9896', '#c5b0d5', '#c49c94', '#f7b6d2', '#c7c7c7', '#dbdb8d', '#9edae5'],
56 | Classic20 = ['#1f77b4', '#aec7e8', '#ff7f0e', '#ffbb78', '#2ca02c', '#98df8a', '#d62728', '#ff9896', '#9467bd', '#c5b0d5', '#8c564b', '#c49c94', '#e377c2', '#f7b6d2', '#7f7f7f', '#c7c7c7', '#bcbd22', '#dbdb8d', '#17becf', '#9edae5'],
57 | ClassicGray5 = ['#60636a', '#a5acaf', '#414451', '#8f8782', '#cfcfcf'],
58 | ClassicColorBlind10 = ['#006ba4', '#ff800e', '#ababab', '#595959', '#5f9ed1', '#c85200', '#898989', '#a2c8ec', '#ffbc79', '#cfcfcf'],
59 | ClassicTrafficLight9 = ['#b10318', '#dba13a', '#309343', '#d82526', '#ffc156', '#69b764', '#f26c64', '#ffdd71', '#9fcd99'],
60 | ClassicPurpleGray6 = ['#7b66d2', '#dc5fbd', '#94917b', '#995688', '#d098ee', '#d7d5c5'],
61 | ClassicPurpleGray12 = ['#7b66d2', '#a699e8', '#dc5fbd', '#ffc0da', '#5f5a41', '#b4b19b', '#995688', '#d898ba', '#ab6ad5', '#d098ee', '#8b7c6e', '#dbd4c5'],
62 | ClassicGreenOrange6 = ['#32a251', '#ff7f0f', '#3cb7cc', '#ffd94a', '#39737c', '#b85a0d'],
63 | ClassicGreenOrange12 = ['#32a251', '#acd98d', '#ff7f0f', '#ffb977', '#3cb7cc', '#98d9e4', '#b85a0d', '#ffd94a', '#39737c', '#86b4a9', '#82853b', '#ccc94d'],
64 | ClassicBlueRed6 = ['#2c69b0', '#f02720', '#ac613c', '#6ba3d6', '#ea6b73', '#e9c39b'],
65 | ClassicBlueRed12 = ['#2c69b0', '#b5c8e2', '#f02720', '#ffb6b0', '#ac613c', '#e9c39b', '#6ba3d6', '#b5dffd', '#ac8763', '#ddc9b4', '#bd0a36', '#f4737a'],
66 | ClassicCyclic13 = ['#1f83b4', '#12a2a8', '#2ca030', '#78a641', '#bcbd22', '#ffbf50', '#ffaa0e', '#ff7f0e', '#d63a3a', '#c7519c', '#ba43b4', '#8a60b0', '#6f63bb'],
67 | ClassicGreen7 = ['#bccfb4', '#94bb83', '#69a761', '#339444', '#27823b', '#1a7232', '#09622a'],
68 | ClassicGray13 = ['#c3c3c3', '#b2b2b2', '#a2a2a2', '#929292', '#838383', '#747474', '#666666', '#585858', '#4b4b4b', '#3f3f3f', '#333333', '#282828', '#1e1e1e'],
69 | ClassicBlue7 = ['#b4d4da', '#7bc8e2', '#67add4', '#3a87b7', '#1c73b1', '#1c5998', '#26456e'],
70 | ClassicRed9 = ['#eac0bd', '#f89a90', '#f57667', '#e35745', '#d8392c', '#cf1719', '#c21417', '#b10c1d', '#9c0824'],
71 | ClassicOrange7 = ['#f0c294', '#fdab67', '#fd8938', '#f06511', '#d74401', '#a33202', '#7b3014'],
72 | ClassicAreaRed11 = ['#f5cac7', '#fbb3ab', '#fd9c8f', '#fe8b7a', '#fd7864', '#f46b55', '#ea5e45', '#e04e35', '#d43e25', '#c92b14', '#bd1100'],
73 | ClassicAreaGreen11 = ['#dbe8b4', '#c3e394', '#acdc7a', '#9ad26d', '#8ac765', '#7abc5f', '#6cae59', '#60a24d', '#569735', '#4a8c1c', '#3c8200'],
74 | ClassicAreaBrown11 = ['#f3e0c2', '#f6d29c', '#f7c577', '#f0b763', '#e4aa63', '#d89c63', '#cc8f63', '#c08262', '#bb7359', '#bb6348', '#bb5137'],
75 | ClassicRedGreen11 = ['#9c0824', '#bd1316', '#d11719', '#df513f', '#fc8375', '#cacaca', '#a2c18f', '#69a761', '#2f8e41', '#1e7735', '#09622a'],
76 | ClassicRedBlue11 = ['#9c0824', '#bd1316', '#d11719', '#df513f', '#fc8375', '#cacaca', '#67add4', '#3a87b7', '#1c73b1', '#1c5998', '#26456e'],
77 | ClassicRedBlack11 = ['#9c0824', '#bd1316', '#d11719', '#df513f', '#fc8375', '#cacaca', '#9b9b9b', '#777777', '#565656', '#383838', '#1e1e1e'],
78 | ClassicAreaRedGreen21 = ['#bd1100', '#c82912', '#d23a21', '#dc4930', '#e6583e', '#ef654d', '#f7705b', '#fd7e6b', '#fe8e7e', '#fca294', '#e9dabe', '#c7e298', '#b1de7f', '#a0d571', '#90cb68', '#82c162', '#75b65d', '#69aa56', '#5ea049', '#559633', '#4a8c1c'],
79 | ClassicOrangeBlue13 = ['#7b3014', '#a33202', '#d74401', '#f06511', '#fd8938', '#fdab67', '#cacaca', '#7bc8e2', '#67add4', '#3a87b7', '#1c73b1', '#1c5998', '#26456e'],
80 | ClassicGreenBlue11 = ['#09622a', '#1e7735', '#2f8e41', '#69a761', '#a2c18f', '#cacaca', '#67add4', '#3a87b7', '#1c73b1', '#1c5998', '#26456e'],
81 | ClassicRedWhiteGreen11 = ['#9c0824', '#b41f27', '#cc312b', '#e86753', '#fcb4a5', '#ffffff', '#b9d7b7', '#74af72', '#428f49', '#297839', '#09622a'],
82 | ClassicRedWhiteBlack11 = ['#9c0824', '#b41f27', '#cc312b', '#e86753', '#fcb4a5', '#ffffff', '#bfbfbf', '#838383', '#575757', '#393939', '#1e1e1e'],
83 | ClassicOrangeWhiteBlue11 = ['#7b3014', '#a84415', '#d85a13', '#fb8547', '#ffc2a1', '#ffffff', '#b7cde2', '#6a9ec5', '#3679a8', '#2e5f8a', '#26456e'],
84 | ClassicRedWhiteBlackLight10 = ['#ffc2c5', '#ffd1d3', '#ffe0e1', '#fff0f0', '#ffffff', '#f3f3f3', '#e8e8e8', '#dddddd', '#d1d1d1', '#c6c6c6'],
85 | ClassicOrangeWhiteBlueLight11 = ['#ffcc9e', '#ffd6b1', '#ffe0c5', '#ffead8', '#fff5eb', '#ffffff', '#f3f7fd', '#e8effa', '#dce8f8', '#d0e0f6', '#c4d8f3'],
86 | ClassicRedWhiteGreenLight11 = ['#ffb2b6', '#ffc2c5', '#ffd1d3', '#ffe0e1', '#fff0f0', '#ffffff', '#f1faed', '#e3f5db', '#d5f0ca', '#c6ebb8', '#b7e6a7'],
87 | ClassicRedGreenLight11 = ['#ffb2b6', '#fcbdc0', '#f8c7c9', '#f2d1d2', '#ecdbdc', '#e5e5e5', '#dde6d9', '#d4e6cc', '#cae6c0', '#c1e6b4', '#b7e6a7'];
88 |
--------------------------------------------------------------------------------
/src/colorschemes/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import * as brewer from './colorschemes.brewer';
4 | import * as office from './colorschemes.office';
5 | import * as tableau from './colorschemes.tableau';
6 |
7 | export default {
8 | brewer: brewer,
9 | office: office,
10 | tableau: tableau
11 | };
12 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import Chart from 'chart.js';
4 | import colorschemes from './colorschemes/index';
5 | import ColorSchemesPlugin from './plugins/plugin.colorschemes';
6 |
7 | Chart.colorschemes = colorschemes;
8 |
9 | export default ColorSchemesPlugin;
10 |
--------------------------------------------------------------------------------
/src/plugins/plugin.colorschemes.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import Chart from 'chart.js';
4 |
5 | var helpers = Chart.helpers;
6 |
7 | // Element models are always reset when hovering in Chart.js 2.7.2 or earlier
8 | var hoverReset = Chart.DatasetController.prototype.removeHoverStyle.length === 2;
9 |
10 | var EXPANDO_KEY = '$colorschemes';
11 |
12 | // pluginBase snippet fixes the chartjs 3 incompatibility, and is backwards-compatible
13 | // by Github user gebrits (https://github.com/gebrits/chartjs-plugin-colorschemes)
14 | //
15 | // Chartjs 2 => Chart.defaults.global
16 | // Chartjs 3 => Chart.defaults
17 | const pluginBase = Chart.defaults.global || Chart.defaults;
18 | pluginBase.plugins.colorschemes = {
19 | scheme: 'brewer.Paired12',
20 | fillAlpha: 0.5,
21 | reverse: false,
22 | override: false
23 | };
24 |
25 | function getScheme(scheme) {
26 | var colorschemes, matches, arr, category;
27 |
28 | if (helpers.isArray(scheme)) {
29 | return scheme;
30 | } else if (typeof scheme === 'string') {
31 | colorschemes = Chart.colorschemes || {};
32 |
33 | // For backward compatibility
34 | matches = scheme.match(/^(brewer\.\w+)([1-3])-(\d+)$/);
35 | if (matches) {
36 | scheme = matches[1] + ['One', 'Two', 'Three'][matches[2] - 1] + matches[3];
37 | } else if (scheme === 'office.Office2007-2010-6') {
38 | scheme = 'office.OfficeClassic6';
39 | }
40 |
41 | arr = scheme.split('.');
42 | category = colorschemes[arr[0]];
43 | if (category) {
44 | return category[arr[1]];
45 | }
46 | }
47 | }
48 |
49 | var ColorSchemesPlugin = {
50 | id: 'colorschemes',
51 |
52 | beforeUpdate: function(chart, args, options) {
53 | // Please note that in v3, the args argument was added. It was not used before it was added,
54 | // so we just check if it is not actually our options object
55 | if (options === undefined) {
56 | options = args;
57 | }
58 |
59 | var scheme = getScheme(options.scheme);
60 | var fillAlpha = options.fillAlpha;
61 | var reverse = options.reverse;
62 | var override = options.override;
63 | var custom = options.custom;
64 | var schemeClone, customResult, length, colorIndex, color;
65 |
66 | if (scheme) {
67 |
68 | if (typeof custom === 'function') {
69 | // clone the original scheme
70 | schemeClone = scheme.slice();
71 |
72 | // Execute own custom color function
73 | customResult = custom(schemeClone);
74 |
75 | // check if we really received a filled array; otherwise we keep and use the original scheme
76 | if (helpers.isArray(customResult) && customResult.length) {
77 | scheme = customResult;
78 | } else if (helpers.isArray(schemeClone) && schemeClone.length) {
79 | scheme = schemeClone;
80 | }
81 | }
82 |
83 | length = scheme.length;
84 |
85 | // Set scheme colors
86 | chart.config.data.datasets.forEach(function(dataset, datasetIndex) {
87 | colorIndex = datasetIndex % length;
88 | color = scheme[reverse ? length - colorIndex - 1 : colorIndex];
89 |
90 | // Object to store which color option is set
91 | dataset[EXPANDO_KEY] = {};
92 |
93 | switch (dataset.type || chart.config.type) {
94 | // For line, radar and scatter chart, borderColor and backgroundColor (50% transparent) are set
95 | case 'line':
96 | case 'radar':
97 | case 'scatter':
98 | if (typeof dataset.backgroundColor === 'undefined' || override) {
99 | dataset[EXPANDO_KEY].backgroundColor = dataset.backgroundColor;
100 | dataset.backgroundColor = helpers.color(color).alpha(fillAlpha).rgbString();
101 | }
102 | if (typeof dataset.borderColor === 'undefined' || override) {
103 | dataset[EXPANDO_KEY].borderColor = dataset.borderColor;
104 | dataset.borderColor = color;
105 | }
106 | if (typeof dataset.pointBackgroundColor === 'undefined' || override) {
107 | dataset[EXPANDO_KEY].pointBackgroundColor = dataset.pointBackgroundColor;
108 | dataset.pointBackgroundColor = helpers.color(color).alpha(fillAlpha).rgbString();
109 | }
110 | if (typeof dataset.pointBorderColor === 'undefined' || override) {
111 | dataset[EXPANDO_KEY].pointBorderColor = dataset.pointBorderColor;
112 | dataset.pointBorderColor = color;
113 | }
114 | break;
115 | // For doughnut and pie chart, backgroundColor is set to an array of colors
116 | case 'doughnut':
117 | case 'pie':
118 | case 'polarArea':
119 | if (typeof dataset.backgroundColor === 'undefined' || override) {
120 | dataset[EXPANDO_KEY].backgroundColor = dataset.backgroundColor;
121 | dataset.backgroundColor = dataset.data.map(function(data, dataIndex) {
122 | colorIndex = dataIndex % length;
123 | return scheme[reverse ? length - colorIndex - 1 : colorIndex];
124 | });
125 | }
126 | break;
127 | // For bar chart backgroundColor (including fillAlpha) and borderColor are set
128 | case 'bar':
129 | if (typeof dataset.backgroundColor === 'undefined' || override) {
130 | dataset[EXPANDO_KEY].backgroundColor = dataset.backgroundColor;
131 | dataset.backgroundColor = helpers.color(color).alpha(fillAlpha).rgbString();
132 | }
133 | if (typeof dataset.borderColor === 'undefined' || override) {
134 | dataset[EXPANDO_KEY].borderColor = dataset.borderColor;
135 | dataset.borderColor = color;
136 | }
137 | break;
138 | // For the other chart, only backgroundColor is set
139 | default:
140 | if (typeof dataset.backgroundColor === 'undefined' || override) {
141 | dataset[EXPANDO_KEY].backgroundColor = dataset.backgroundColor;
142 | dataset.backgroundColor = color;
143 | }
144 | break;
145 | }
146 | });
147 | }
148 | },
149 |
150 | afterUpdate: function(chart) {
151 | // Unset colors
152 | chart.config.data.datasets.forEach(function(dataset) {
153 | if (dataset[EXPANDO_KEY]) {
154 | if (dataset[EXPANDO_KEY].hasOwnProperty('backgroundColor')) {
155 | dataset.backgroundColor = dataset[EXPANDO_KEY].backgroundColor;
156 | }
157 | if (dataset[EXPANDO_KEY].hasOwnProperty('borderColor')) {
158 | dataset.borderColor = dataset[EXPANDO_KEY].borderColor;
159 | }
160 | if (dataset[EXPANDO_KEY].hasOwnProperty('pointBackgroundColor')) {
161 | dataset.pointBackgroundColor = dataset[EXPANDO_KEY].pointBackgroundColor;
162 | }
163 | if (dataset[EXPANDO_KEY].hasOwnProperty('pointBorderColor')) {
164 | dataset.pointBorderColor = dataset[EXPANDO_KEY].pointBorderColor;
165 | }
166 | delete dataset[EXPANDO_KEY];
167 | }
168 | });
169 | },
170 |
171 | beforeEvent: function(chart, event, options) {
172 | if (hoverReset) {
173 | this.beforeUpdate(chart, options);
174 | }
175 | },
176 |
177 | afterEvent: function(chart) {
178 | if (hoverReset) {
179 | this.afterUpdate(chart);
180 | }
181 | }
182 | };
183 |
184 | Chart.plugins.register(ColorSchemesPlugin);
185 |
186 | export default ColorSchemesPlugin;
187 |
--------------------------------------------------------------------------------
/test/.eslintrc.yml:
--------------------------------------------------------------------------------
1 | env:
2 | jasmine: true
3 |
4 | globals:
5 | __karma__: true
6 |
7 | # http://eslint.org/docs/rules/
8 | rules:
9 | # Best Practices
10 | complexity: 0
11 | no-new-func: 0
12 |
--------------------------------------------------------------------------------
/test/fixture.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import utils from './utils';
4 |
5 | function readFile(url, callback) {
6 | var request = new XMLHttpRequest();
7 | request.onreadystatechange = function() {
8 | if (request.readyState === 4) {
9 | return callback(request.responseText);
10 | }
11 | };
12 |
13 | request.open('GET', url, false);
14 | request.send(null);
15 | }
16 |
17 | function loadConfig(url, callback) {
18 | var regex = /\.(json|js)$/i;
19 | var matches = url.match(regex);
20 | var type = matches ? matches[1] : 'json';
21 | var cfg = null;
22 |
23 | readFile(url, function(content) {
24 | switch (type) {
25 | case 'js':
26 | cfg = new Function('"use strict";' + content + ';return fixture;')();
27 | break;
28 | case 'json':
29 | cfg = JSON.parse(content);
30 | break;
31 | default:
32 | }
33 |
34 | callback(cfg);
35 | });
36 | }
37 |
38 | function specFromFixture(description, inputs) {
39 | var input = inputs.js || inputs.json;
40 | it(input, function(done) {
41 | loadConfig(input, function(json) {
42 | var chart = utils.acquireChart(json.config, json.options);
43 | if (!inputs.png) {
44 | fail('Missing PNG comparison file for ' + inputs.json);
45 | done();
46 | }
47 |
48 | utils.readImageData(inputs.png, function(expected) {
49 | expect(chart).toEqualImageData(expected, json);
50 | utils.releaseChart(chart);
51 | done();
52 | });
53 | });
54 | });
55 | }
56 |
57 | function specsFromFixtures(path) {
58 | var regex = new RegExp('(^/base/test/fixtures/' + path + '.+)\\.(png|json|js)');
59 | var inputs = {};
60 |
61 | Object.keys(__karma__.files || {}).forEach(function(file) {
62 | var matches = file.match(regex);
63 | var name = matches && matches[1];
64 | var type = matches && matches[2];
65 |
66 | if (name && type) {
67 | inputs[name] = inputs[name] || {};
68 | inputs[name][type] = file;
69 | }
70 | });
71 |
72 | return function() {
73 | Object.keys(inputs).forEach(function(key) {
74 | specFromFixture(key, inputs[key]);
75 | });
76 | };
77 | }
78 |
79 | export default {
80 | specs: specsFromFixtures
81 | };
82 |
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-bar-fillAlpha.js:
--------------------------------------------------------------------------------
1 | // https://github.com/nagix/chartjs-plugin-colorschemes/issues/12
2 | export default {
3 | config: {
4 | type: 'bar',
5 | data: {
6 | labels: [0, 1, 2, 3, 4, 5],
7 | datasets: [{
8 | data: [0, 5, 10, 0, -10, -5]
9 | }, {
10 | data: [10, 0, -10, -5, 0, 5]
11 | }, {
12 | data: [-10, -5, 0, 5, 10, 0]
13 | }]
14 | },
15 | options: {
16 | legend: false,
17 | title: false,
18 | layout: {
19 | padding: 4
20 | },
21 | scales: {
22 | xAxes: [{display: false}],
23 | yAxes: [{display: false}]
24 | },
25 | plugins: {
26 | colorschemes: {
27 | scheme: 'brewer.Accent3',
28 | fillAlpha: 0.2
29 | }
30 | }
31 | }
32 | },
33 | options: {
34 | canvas: {
35 | height: 256,
36 | width: 512
37 | }
38 | }
39 | };
40 |
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-bar-fillAlpha.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nagix/chartjs-plugin-colorschemes/d96a01846626881aa4bec56828c333af81050906/test/fixtures/plugin.colorschemes/chart-bar-fillAlpha.png
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-bar.js:
--------------------------------------------------------------------------------
1 | export default {
2 | config: {
3 | type: 'bar',
4 | data: {
5 | labels: [0, 1, 2, 3, 4, 5],
6 | datasets: [{
7 | data: [0, 5, 10, 0, -10, -5]
8 | }, {
9 | data: [10, 0, -10, -5, 0, 5]
10 | }, {
11 | data: [-10, -5, 0, 5, 10, 0]
12 | }]
13 | },
14 | options: {
15 | legend: false,
16 | title: false,
17 | layout: {
18 | padding: 4
19 | },
20 | scales: {
21 | xAxes: [{display: false}],
22 | yAxes: [{display: false}]
23 | },
24 | plugins: {
25 | colorschemes: {
26 | scheme: 'brewer.Accent3',
27 | fillAlpha: 1
28 | }
29 | }
30 | }
31 | },
32 | options: {
33 | canvas: {
34 | height: 256,
35 | width: 512
36 | }
37 | }
38 | };
39 |
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-bar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nagix/chartjs-plugin-colorschemes/d96a01846626881aa4bec56828c333af81050906/test/fixtures/plugin.colorschemes/chart-bar.png
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-bubble.js:
--------------------------------------------------------------------------------
1 | export default {
2 | config: {
3 | type: 'bubble',
4 | data: {
5 | datasets: [{
6 | data: [
7 | {x: 0, y: 0, r: 30},
8 | {x: 1, y: 5, r: 20},
9 | {x: 2, y: 10, r: 20},
10 | {x: 3, y: 0, r: 10},
11 | {x: 4, y: -10, r: 10},
12 | {x: 5, y: -5, r: 30}
13 | ]
14 | }, {
15 | data: [
16 | {x: 0, y: 10, r: 10},
17 | {x: 1, y: 0, r: 30},
18 | {x: 2, y: -10, r: 30},
19 | {x: 3, y: -5, r: 20},
20 | {x: 4, y: 0, r: 20},
21 | {x: 5, y: 5, r: 10}
22 | ]
23 | }, {
24 | data: [
25 | {x: 0, y: -10, r: 20},
26 | {x: 1, y: -5, r: 10},
27 | {x: 2, y: 0, r: 10},
28 | {x: 3, y: 5, r: 30},
29 | {x: 4, y: 10, r: 30},
30 | {x: 5, y: 0, r: 20}
31 | ]
32 | }]
33 | },
34 | options: {
35 | legend: false,
36 | title: false,
37 | layout: {
38 | padding: 30
39 | },
40 | scales: {
41 | xAxes: [{display: false}],
42 | yAxes: [{display: false}]
43 | },
44 | plugins: {
45 | colorschemes: {
46 | scheme: 'brewer.Accent3'
47 | }
48 | }
49 | }
50 | },
51 | options: {
52 | canvas: {
53 | height: 256,
54 | width: 512
55 | }
56 | }
57 | };
58 |
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-bubble.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nagix/chartjs-plugin-colorschemes/d96a01846626881aa4bec56828c333af81050906/test/fixtures/plugin.colorschemes/chart-bubble.png
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-doughnut.js:
--------------------------------------------------------------------------------
1 | export default {
2 | config: {
3 | type: 'doughnut',
4 | data: {
5 | labels: [0, 1, 2, 3, 4, 5],
6 | datasets: [{
7 | data: [1, 2, 3, 1, 3, 2]
8 | }, {
9 | data: [3, 1, 3, 2, 1, 2]
10 | }, {
11 | data: [3, 2, 1, 2, 3, 1]
12 | }]
13 | },
14 | options: {
15 | legend: false,
16 | title: false,
17 | plugins: {
18 | colorschemes: {
19 | scheme: 'brewer.Accent6'
20 | }
21 | }
22 | }
23 | },
24 | options: {
25 | canvas: {
26 | height: 512,
27 | width: 512
28 | }
29 | }
30 | };
31 |
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-doughnut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nagix/chartjs-plugin-colorschemes/d96a01846626881aa4bec56828c333af81050906/test/fixtures/plugin.colorschemes/chart-doughnut.png
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-horizontal-bar.js:
--------------------------------------------------------------------------------
1 | export default {
2 | config: {
3 | type: 'horizontalBar',
4 | data: {
5 | labels: [0, 1, 2, 3, 4, 5],
6 | datasets: [{
7 | data: [0, 5, 10, 0, -10, -5]
8 | }, {
9 | data: [10, 0, -10, -5, 0, 5]
10 | }, {
11 | data: [-10, -5, 0, 5, 10, 0]
12 | }]
13 | },
14 | options: {
15 | legend: false,
16 | title: false,
17 | layout: {
18 | padding: 4
19 | },
20 | scales: {
21 | xAxes: [{display: false}],
22 | yAxes: [{display: false}]
23 | },
24 | plugins: {
25 | colorschemes: {
26 | scheme: 'brewer.Accent3'
27 | }
28 | }
29 | }
30 | },
31 | options: {
32 | canvas: {
33 | height: 256,
34 | width: 512
35 | }
36 | }
37 | };
38 |
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-horizontal-bar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nagix/chartjs-plugin-colorschemes/d96a01846626881aa4bec56828c333af81050906/test/fixtures/plugin.colorschemes/chart-horizontal-bar.png
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-line.js:
--------------------------------------------------------------------------------
1 | export default {
2 | config: {
3 | type: 'line',
4 | data: {
5 | labels: [0, 1, 2, 3, 4, 5],
6 | datasets: [{
7 | data: [0, 5, 10, 0, -10, -5]
8 | }, {
9 | data: [10, 0, -10, -5, 0, 5]
10 | }, {
11 | data: [-10, -5, 0, 5, 10, 0]
12 | }]
13 | },
14 | options: {
15 | legend: false,
16 | title: false,
17 | layout: {
18 | padding: 4
19 | },
20 | scales: {
21 | xAxes: [{display: false}],
22 | yAxes: [{display: false}]
23 | },
24 | plugins: {
25 | colorschemes: {
26 | scheme: 'brewer.Accent3'
27 | }
28 | }
29 | }
30 | },
31 | options: {
32 | canvas: {
33 | height: 256,
34 | width: 512
35 | }
36 | }
37 | };
38 |
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nagix/chartjs-plugin-colorschemes/d96a01846626881aa4bec56828c333af81050906/test/fixtures/plugin.colorschemes/chart-line.png
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-pie.js:
--------------------------------------------------------------------------------
1 | export default {
2 | config: {
3 | type: 'pie',
4 | data: {
5 | labels: [0, 1, 2, 3, 4, 5],
6 | datasets: [{
7 | data: [1, 2, 3, 1, 3, 2]
8 | }, {
9 | data: [3, 1, 3, 2, 1, 2]
10 | }, {
11 | data: [3, 2, 1, 2, 3, 1]
12 | }]
13 | },
14 | options: {
15 | legend: false,
16 | title: false,
17 | plugins: {
18 | colorschemes: {
19 | scheme: 'brewer.Accent6'
20 | }
21 | }
22 | }
23 | },
24 | options: {
25 | canvas: {
26 | height: 512,
27 | width: 512
28 | }
29 | }
30 | };
31 |
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-pie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nagix/chartjs-plugin-colorschemes/d96a01846626881aa4bec56828c333af81050906/test/fixtures/plugin.colorschemes/chart-pie.png
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-polar-area.js:
--------------------------------------------------------------------------------
1 | export default {
2 | config: {
3 | type: 'polarArea',
4 | data: {
5 | labels: [0, 1, 2, 3, 4, 5],
6 | datasets: [{
7 | data: [0, 5, 10, 0, -10, -5]
8 | }]
9 | },
10 | options: {
11 | legend: false,
12 | title: false,
13 | scale: {
14 | display: false
15 | },
16 | plugins: {
17 | colorschemes: {
18 | scheme: 'brewer.Accent6'
19 | }
20 | }
21 | }
22 | },
23 | options: {
24 | canvas: {
25 | height: 512,
26 | width: 512
27 | }
28 | }
29 | };
30 |
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-polar-area.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nagix/chartjs-plugin-colorschemes/d96a01846626881aa4bec56828c333af81050906/test/fixtures/plugin.colorschemes/chart-polar-area.png
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-radar.js:
--------------------------------------------------------------------------------
1 | export default {
2 | config: {
3 | type: 'radar',
4 | data: {
5 | labels: [0, 1, 2, 3, 4, 5],
6 | datasets: [{
7 | data: [0, 5, 10, 0, -10, -5]
8 | }, {
9 | data: [10, 0, -10, -5, 0, 5]
10 | }, {
11 | data: [-10, -5, 0, 5, 10, 0]
12 | }]
13 | },
14 | options: {
15 | legend: false,
16 | title: false,
17 | layout: {
18 | padding: 4
19 | },
20 | scale: {
21 | display: false
22 | },
23 | plugins: {
24 | colorschemes: {
25 | scheme: 'brewer.Accent3'
26 | }
27 | }
28 | }
29 | },
30 | options: {
31 | canvas: {
32 | height: 512,
33 | width: 512
34 | }
35 | }
36 | };
37 |
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-radar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nagix/chartjs-plugin-colorschemes/d96a01846626881aa4bec56828c333af81050906/test/fixtures/plugin.colorschemes/chart-radar.png
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-scatter.js:
--------------------------------------------------------------------------------
1 | export default {
2 | config: {
3 | type: 'scatter',
4 | data: {
5 | datasets: [{
6 | data: [
7 | {x: 0, y: 0},
8 | {x: 1, y: 5},
9 | {x: 2, y: 10},
10 | {x: 3, y: 0},
11 | {x: 4, y: -10},
12 | {x: 5, y: -5}
13 | ]
14 | }, {
15 | data: [
16 | {x: 0, y: 10},
17 | {x: 1, y: 0},
18 | {x: 2, y: -10},
19 | {x: 3, y: -5},
20 | {x: 4, y: 0},
21 | {x: 5, y: 5}
22 | ]
23 | }, {
24 | data: [
25 | {x: 0, y: -10},
26 | {x: 1, y: -5},
27 | {x: 2, y: 0},
28 | {x: 3, y: 5},
29 | {x: 4, y: 10},
30 | {x: 5, y: 0}
31 | ]
32 | }]
33 | },
34 | options: {
35 | legend: false,
36 | title: false,
37 | layout: {
38 | padding: 4
39 | },
40 | scales: {
41 | xAxes: [{display: false}],
42 | yAxes: [{display: false}]
43 | },
44 | plugins: {
45 | colorschemes: {
46 | scheme: 'brewer.Accent3'
47 | }
48 | }
49 | }
50 | },
51 | options: {
52 | canvas: {
53 | height: 256,
54 | width: 512
55 | }
56 | }
57 | };
58 |
--------------------------------------------------------------------------------
/test/fixtures/plugin.colorschemes/chart-scatter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nagix/chartjs-plugin-colorschemes/d96a01846626881aa4bec56828c333af81050906/test/fixtures/plugin.colorschemes/chart-scatter.png
--------------------------------------------------------------------------------
/test/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import Chart from 'chart.js';
4 | import fixture from './fixture';
5 | import matchers from './matchers';
6 | import utils from './utils';
7 |
8 | window.devicePixelRatio = 1;
9 |
10 | var charts = {};
11 |
12 | jasmine.chart = {
13 | acquire: function() {
14 | var chart = utils.acquireChart.apply(utils, arguments);
15 | charts[chart.id] = chart;
16 | return chart;
17 | },
18 | release: function(chart) {
19 | utils.releaseChart.apply(utils, arguments);
20 | delete charts[chart.id];
21 | }
22 | };
23 |
24 | jasmine.fixture = fixture;
25 | jasmine.triggerMouseEvent = utils.triggerMouseEvent;
26 |
27 | beforeEach(function() {
28 | jasmine.addMatchers(matchers);
29 |
30 | Chart.helpers.merge(Chart.defaults.global, {
31 | animation: false,
32 | legend: {display: false},
33 | responsive: false,
34 | title: {display: false},
35 | tooltips: false,
36 | elements: {
37 | arc: {
38 | backgroundColor: 'transparent',
39 | borderColor: 'rgba(0, 0, 0, 0.1)',
40 | borderWidth: 1
41 | },
42 | point: {
43 | backgroundColor: 'transparent',
44 | borderColor: 'rgba(0, 0, 0, 0.1)',
45 | borderWidth: 1
46 | },
47 | rectangle: {
48 | backgroundColor: 'transparent',
49 | borderColor: 'rgba(0, 0, 0, 0.1)',
50 | borderWidth: 1
51 | }
52 | }
53 | });
54 |
55 | Chart.helpers.merge(Chart.defaults.scale, {
56 | display: false,
57 | ticks: {
58 | beginAtZero: true
59 | }
60 | });
61 | });
62 |
63 | afterEach(function() {
64 | // Auto releasing acquired charts
65 | Object.keys(charts).forEach(function(id) {
66 | var chart = charts[id];
67 | if (!(chart.$test || {}).persistent) {
68 | jasmine.chart.release(chart);
69 | }
70 | });
71 | });
72 |
--------------------------------------------------------------------------------
/test/matchers.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import Chart from 'chart.js';
4 | import pixelmatch from 'pixelmatch';
5 | import utils from './utils';
6 |
7 | function toPercent(value) {
8 | return Math.round(value * 10000) / 100;
9 | }
10 |
11 | function buildPixelMatchPreview(actual, expected, diff, threshold, tolerance, count) {
12 | var ratio = count / (actual.width * actual.height);
13 | var wrapper = document.createElement('div');
14 |
15 | wrapper.style.cssText = 'display: flex; overflow-y: auto';
16 |
17 | [
18 | {data: actual, label: 'Actual'},
19 | {data: expected, label: 'Expected'},
20 | {data: diff, label:
21 | 'diff: ' + count + 'px ' +
22 | '(' + toPercent(ratio) + '%) ' +
23 | 'thr: ' + toPercent(threshold) + '%, ' +
24 | 'tol: ' + toPercent(tolerance) + '%'
25 | }
26 | ].forEach(function(values) {
27 | var item = document.createElement('div');
28 | item.style.cssText = 'text-align: center; font: 12px monospace; line-height: 1.4; margin: 8px';
29 | item.innerHTML = '' + values.label + '
';
30 | item.appendChild(utils.canvasFromImageData(values.data));
31 | wrapper.appendChild(item);
32 | });
33 |
34 | // WORKAROUND: https://github.com/karma-runner/karma-jasmine/issues/139
35 | wrapper.indexOf = function() {
36 | return -1;
37 | };
38 |
39 | return wrapper;
40 | }
41 |
42 | function toEqualImageData() {
43 | return {
44 | compare: function(actual, expected, opts) {
45 | var message = null;
46 | var debug = opts.debug || false;
47 | var tolerance = opts.tolerance === undefined ? 0.001 : opts.tolerance;
48 | var threshold = opts.threshold === undefined ? 0.1 : opts.threshold;
49 | var ctx, idata, ddata, w, h, count, ratio;
50 |
51 | if (actual instanceof Chart) {
52 | ctx = actual.ctx;
53 | } else if (actual instanceof HTMLCanvasElement) {
54 | ctx = actual.getContext('2d');
55 | } else if (actual instanceof CanvasRenderingContext2D) {
56 | ctx = actual;
57 | }
58 |
59 | if (ctx) {
60 | h = expected.height;
61 | w = expected.width;
62 | idata = ctx.getImageData(0, 0, w, h);
63 | ddata = utils.createImageData(w, h);
64 | count = pixelmatch(idata.data, expected.data, ddata.data, w, h, {threshold: threshold});
65 | ratio = count / (w * h);
66 |
67 | if ((ratio > tolerance) || debug) {
68 | message = buildPixelMatchPreview(idata, expected, ddata, threshold, tolerance, count);
69 | }
70 | } else {
71 | message = 'Input value is not a valid image source.';
72 | }
73 |
74 | return {
75 | message: message,
76 | pass: !message
77 | };
78 | }
79 | };
80 | }
81 |
82 | export default {
83 | toEqualImageData: toEqualImageData
84 | };
85 |
--------------------------------------------------------------------------------
/test/specs/plugin.colorschemes.spec.js:
--------------------------------------------------------------------------------
1 | describe('plugin.colorschemes', function() {
2 | describe('auto', jasmine.fixture.specs('plugin.colorschemes'));
3 | });
4 |
--------------------------------------------------------------------------------
/test/utils.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import Chart from 'chart.js';
4 |
5 | function createCanvas(w, h) {
6 | var canvas = document.createElement('CANVAS');
7 | canvas.width = w;
8 | canvas.height = h;
9 | return canvas;
10 | }
11 |
12 | function createImageData(w, h) {
13 | var canvas = createCanvas(w, h);
14 | var context = canvas.getContext('2d');
15 | return context.getImageData(0, 0, w, h);
16 | }
17 |
18 | function readImageData(url, callback) {
19 | var image = new Image();
20 |
21 | image.onload = function() {
22 | var h = image.height;
23 | var w = image.width;
24 | var canvas = createCanvas(w, h);
25 | var ctx = canvas.getContext('2d');
26 | ctx.drawImage(image, 0, 0, w, h);
27 | callback(ctx.getImageData(0, 0, w, h));
28 | };
29 |
30 | image.src = url;
31 | }
32 |
33 | function canvasFromImageData(data) {
34 | var canvas = createCanvas(data.width, data.height);
35 | var context = canvas.getContext('2d');
36 | context.putImageData(data, 0, 0);
37 | return canvas;
38 | }
39 |
40 | function acquireChart(config, options) {
41 | var wrapper = document.createElement('DIV');
42 | var canvas = document.createElement('CANVAS');
43 | var chart, key;
44 |
45 | config = config || {};
46 | options = options || {};
47 | options.canvas = options.canvas || {height: 512, width: 512};
48 | options.wrapper = options.wrapper || {class: 'chartjs-wrapper'};
49 |
50 | for (key in options.canvas) {
51 | if (options.canvas.hasOwnProperty(key)) {
52 | canvas.setAttribute(key, options.canvas[key]);
53 | }
54 | }
55 |
56 | for (key in options.wrapper) {
57 | if (options.wrapper.hasOwnProperty(key)) {
58 | wrapper.setAttribute(key, options.wrapper[key]);
59 | }
60 | }
61 |
62 | // by default, remove chart animation and auto resize
63 | config.options = config.options || {};
64 | config.options.animation = config.options.animation === undefined ? false : config.options.animation;
65 | config.options.responsive = config.options.responsive === undefined ? false : config.options.responsive;
66 | config.options.defaultFontFamily = config.options.defaultFontFamily || 'Arial';
67 |
68 | wrapper.appendChild(canvas);
69 | window.document.body.appendChild(wrapper);
70 |
71 | try {
72 | chart = new Chart(canvas.getContext('2d'), config);
73 | } catch (e) {
74 | window.document.body.removeChild(wrapper);
75 | throw e;
76 | }
77 |
78 | chart.$test = {
79 | persistent: options.persistent,
80 | wrapper: wrapper
81 | };
82 |
83 | return chart;
84 | }
85 |
86 | function releaseChart(chart) {
87 | chart.destroy();
88 |
89 | var wrapper = (chart.$test || {}).wrapper;
90 | if (wrapper && wrapper.parentNode) {
91 | wrapper.parentNode.removeChild(wrapper);
92 | }
93 | }
94 |
95 | function triggerMouseEvent(chart, type, el) {
96 | var node = chart.canvas;
97 | var rect = node.getBoundingClientRect();
98 | var x = el ? el.x !== undefined ? el.x : el._model.x : null;
99 | var y = el ? el.y !== undefined ? el.y : el._model.y : null;
100 |
101 | var event = new MouseEvent(type, {
102 | clientX: el ? rect.left + x : undefined,
103 | clientY: el ? rect.top + y : undefined,
104 | cancelable: true,
105 | bubbles: true,
106 | view: window
107 | });
108 |
109 | node.dispatchEvent(event);
110 | }
111 |
112 | export default {
113 | acquireChart: acquireChart,
114 | releaseChart: releaseChart,
115 | createCanvas: createCanvas,
116 | createImageData: createImageData,
117 | canvasFromImageData: canvasFromImageData,
118 | readImageData: readImageData,
119 | triggerMouseEvent: triggerMouseEvent
120 | };
121 |
--------------------------------------------------------------------------------