1 | import {cubehelix as colorCubehelix} from "d3-color";
|
2 | import color, {hue} from "./color";
|
3 |
|
4 | function cubehelix(hue) {
|
5 | return (function cubehelixGamma(y) {
|
6 | y = +y;
|
7 |
|
8 | function cubehelix(start, end) {
|
9 | var h = hue((start = colorCubehelix(start)).h, (end = colorCubehelix(end)).h),
|
10 | s = color(start.s, end.s),
|
11 | l = color(start.l, end.l),
|
12 | opacity = color(start.opacity, end.opacity);
|
13 | return function(t) {
|
14 | start.h = h(t);
|
15 | start.s = s(t);
|
16 | start.l = l(Math.pow(t, y));
|
17 | start.opacity = opacity(t);
|
18 | return start + "";
|
19 | };
|
20 | }
|
21 |
|
22 | cubehelix.gamma = cubehelixGamma;
|
23 |
|
24 | return cubehelix;
|
25 | })(1);
|
26 | }
|
27 |
|
28 | export default cubehelix(hue);
|
29 | export var cubehelixLong = cubehelix(color);
|