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