Skip to content

Commit d226c7a

Browse files
committed
581a dry colors - new, central place
1 parent 0714747 commit d226c7a

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/**
2+
* Copyright 2012-2016, Plotly, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
'use strict';
10+
11+
module.exports = function makeColorScaleAttributes(context) {
12+
return {
13+
color: {
14+
valType: 'color',
15+
arrayOk: true,
16+
role: 'style',
17+
description: [
18+
'Sets the ', context, ' color. It accepts either a specific color',
19+
' or an array of values that are mapped to the colorscale',
20+
' relative to the max and min values of the array or relative to',
21+
' `cmin` and `cmax` if set.'
22+
].join('')
23+
},
24+
colorscale: {
25+
valType: 'colorscale',
26+
role: 'style',
27+
description: [
28+
'Sets the colorscale and only has an effect',
29+
' if `', context, '.color` is set to a numerical array.',
30+
' The colorscale must be an array containing',
31+
' arrays mapping a normalized value to an',
32+
' rgb, rgba, hex, hsl, hsv, or named color string.',
33+
' At minimum, a mapping for the lowest (0) and highest (1)',
34+
' values are required. For example,',
35+
' `[[0, \'rgb(0,0,255)\', [1, \'rgb(255,0,0)\']]`.',
36+
' To control the bounds of the colorscale in color space,',
37+
' use `', context, '.cmin` and `', context, '.cmax`.'
38+
].join('')
39+
},
40+
cauto: {
41+
valType: 'boolean',
42+
dflt: true,
43+
role: 'style',
44+
description: [
45+
'Has an effect only if `', context, '.color` is set to a numerical array.',
46+
' Determines the whether or not the color domain is computed',
47+
' automatically.'
48+
].join('')
49+
},
50+
cmax: {
51+
valType: 'number',
52+
dflt: null,
53+
role: 'info',
54+
description: [
55+
'Has an effect only if `', context, '.color` is set to a numerical array.',
56+
' Sets the upper bound of the color domain.',
57+
' Value should be associated to the `', context, '.color` array index,',
58+
' and if set, `', context, '.cmin` must be set as well.'
59+
].join('')
60+
},
61+
cmin: {
62+
valType: 'number',
63+
dflt: null,
64+
role: 'info',
65+
description: [
66+
'Has an effect only if `', context, '.color` is set to a numerical array.',
67+
' Sets the lower bound of the color domain.',
68+
' Value should be associated to the `', context, '.color` array index,',
69+
' and if set, `', context, '.cmax` must be set as well.'
70+
].join('')
71+
},
72+
autocolorscale: {
73+
valType: 'boolean',
74+
dflt: true,
75+
role: 'style',
76+
description: [
77+
'Has an effect only if `', context, '.color` is set to a numerical array.',
78+
' Determines whether or not the colorscale is picked using',
79+
' values inside `', context, '.color`.'
80+
].join('')
81+
},
82+
reversescale: {
83+
valType: 'boolean',
84+
role: 'style',
85+
dflt: false,
86+
description: [
87+
'Has an effect only if `', context, '.color` is set to a numerical array.',
88+
' Reverses the colorscale.'
89+
].join('')
90+
}
91+
};
92+
};

0 commit comments

Comments
 (0)