-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathconstants.js
71 lines (69 loc) · 2.19 KB
/
constants.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**
* Copyright 2012-2021, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
module.exports = {
colormodel: {
// min and max define the numerical range accepted in CSS
// If z(min|max)Dflt are not defined, z(min|max) will default to min/max
rgb: {
min: [0, 0, 0],
max: [255, 255, 255],
fmt: function(c) {return c.slice(0, 3);},
suffix: ['', '', '']
},
rgba: {
min: [0, 0, 0, 0],
max: [255, 255, 255, 1],
fmt: function(c) {return c.slice(0, 4);},
suffix: ['', '', '', '']
},
rgba256: {
colormodel: 'rgba', // because rgba256 is not an accept colormodel in CSS
zminDflt: [0, 0, 0, 0],
zmaxDflt: [255, 255, 255, 255],
min: [0, 0, 0, 0],
max: [255, 255, 255, 1],
fmt: function(c) {return c.slice(0, 4);},
suffix: ['', '', '', '']
},
hsl: {
min: [0, 0, 0],
max: [360, 100, 100],
fmt: function(c) {
var p = c.slice(0, 3);
p[1] = p[1] + '%';
p[2] = p[2] + '%';
return p;
},
suffix: ['°', '%', '%']
},
hsla: {
min: [0, 0, 0, 0],
max: [360, 100, 100, 1],
fmt: function(c) {
var p = c.slice(0, 4);
p[1] = p[1] + '%';
p[2] = p[2] + '%';
return p;
},
suffix: ['°', '%', '%', '']
}
},
// For pixelated image rendering
// http://phrogz.net/tmp/canvas_image_zoom.html
// https://developer.mozilla.org/en-US/docs/Web/CSS/image-rendering
pixelatedStyle: [
'image-rendering: optimizeSpeed',
'image-rendering: -moz-crisp-edges',
'image-rendering: -o-crisp-edges',
'image-rendering: -webkit-optimize-contrast',
'image-rendering: optimize-contrast',
'image-rendering: crisp-edges',
'image-rendering: pixelated'
].join('; ')
};