How to use the d3-color.cubehelix function in d3-color

To help you get started, we’ve selected a few d3-color examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / d3-color / d3-color-tests.ts View on Github external
cHcl = cHcl.brighter(0.2);
cHcl = cHcl.darker();
cHcl = cHcl.darker(0.2);
cRGB = cHcl.rgb();
displayable = cHcl.displayable();
cString = cHcl.toString();
console.log('Channels = (h : %d, c: %d, l: %d)', cHcl.h, cHcl.c, cHcl.l);
console.log('Opacity = %d', cHcl.opacity);

// Signature tests for Cubehelix

let cCubehelix: d3Color.CubehelixColor;

cCubehelix = d3Color.cubehelix(20, 100, 200);
cCubehelix = d3Color.cubehelix(20, 100, 200, 0.5);
cCubehelix = d3Color.cubehelix('steelblue');
cCubehelix = d3Color.cubehelix('rgba(20, 100, 200, 0.5)');
cCubehelix = d3Color.cubehelix(c);
cCubehelix = cCubehelix.brighter();
cCubehelix = cCubehelix.brighter(0.2);
cCubehelix = cCubehelix.darker();
cCubehelix = cCubehelix.darker(0.2);
cRGB = cCubehelix.rgb();
displayable = cCubehelix.displayable();
cString = cCubehelix.toString();
console.log('Channels = (h : %d, s: %d, l: %d)', cCubehelix.h, cCubehelix.s, cCubehelix.l);
console.log('Opacity = %d', cCubehelix.opacity);
github DefinitelyTyped / DefinitelyTyped / d3-color / d3-color-tests.ts View on Github external
cHcl = cHcl.darker();
cHcl = cHcl.darker(0.2);
cRGB = cHcl.rgb();
displayable = cHcl.displayable();
cString = cHcl.toString();
console.log('Channels = (h : %d, c: %d, l: %d)', cHcl.h, cHcl.c, cHcl.l);
console.log('Opacity = %d', cHcl.opacity);

// Signature tests for Cubehelix

let cCubehelix: d3Color.CubehelixColor;

cCubehelix = d3Color.cubehelix(20, 100, 200);
cCubehelix = d3Color.cubehelix(20, 100, 200, 0.5);
cCubehelix = d3Color.cubehelix('steelblue');
cCubehelix = d3Color.cubehelix('rgba(20, 100, 200, 0.5)');
cCubehelix = d3Color.cubehelix(c);
cCubehelix = cCubehelix.brighter();
cCubehelix = cCubehelix.brighter(0.2);
cCubehelix = cCubehelix.darker();
cCubehelix = cCubehelix.darker(0.2);
cRGB = cCubehelix.rgb();
displayable = cCubehelix.displayable();
cString = cCubehelix.toString();
console.log('Channels = (h : %d, s: %d, l: %d)', cCubehelix.h, cCubehelix.s, cCubehelix.l);
console.log('Opacity = %d', cCubehelix.opacity);
github d3 / d3-scale-chromatic / src / sequential-multi / rainbow.js View on Github external
import {cubehelix} from "d3-color";
import {interpolateCubehelixLong} from "d3-interpolate";

export var warm = interpolateCubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.50, 0.8));

export var cool = interpolateCubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, 0.8));

var c = cubehelix();

export default function(t) {
  if (t < 0 || t > 1) t -= Math.floor(t);
  var ts = Math.abs(t - 0.5);
  c.h = 360 * t - 100;
  c.s = 1.5 - 1.5 * ts;
  c.l = 0.8 - 0.9 * ts;
  return c + "";
}
github d3 / d3-interpolate / src / cubehelix.js View on Github external
function cubehelix(start, end) {
      var h = hue((start = colorCubehelix(start)).h, (end = colorCubehelix(end)).h),
          s = color(start.s, end.s),
          l = color(start.l, end.l),
          opacity = color(start.opacity, end.opacity);
      return function(t) {
        start.h = h(t);
        start.s = s(t);
        start.l = l(Math.pow(t, y));
        start.opacity = opacity(t);
        return start + "";
      };
    }
github darosh / angular-swagger-ui-material / lib / api-models-rainbows / index.js View on Github external
colors[key].forEach(function (c) {
                            c.pop();

                            var n = d3Color.rgb(c[0], c[1], c[2], 1);
                            var h = d3Color.cubehelix(n);
                            h.s = Math.max(h.s, 1);
                            h.l = Math.max(h.l, 0.8);
                            h.l = Math.min(h.l, 1.2);

                            c[0] = h.h;
                            c[1] = h.s;
                            c[2] = h.l;
                        });
github d3 / d3-scale / src / rainbow.js View on Github external
import {cubehelix} from "d3-color";
import {interpolateCubehelixLong} from "d3-interpolate";

export var warm = interpolateCubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.50, 0.8));

export var cool = interpolateCubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, 0.8));

var rainbow = cubehelix();

export default function(t) {
  if (t < 0 || t > 1) t -= Math.floor(t);
  var ts = Math.abs(t - 0.5);
  rainbow.h = 360 * t - 100;
  rainbow.s = 1.5 - 1.5 * ts;
  rainbow.l = 0.8 - 0.9 * ts;
  return rainbow + "";
}
github d3 / d3-scale / src / cubehelix.js View on Github external
import {cubehelix} from "d3-color";
import {interpolateCubehelixLong} from "d3-interpolate";

export default interpolateCubehelixLong(cubehelix(300, 0.5, 0.0), cubehelix(-240, 0.5, 1.0));
github d3 / d3-scale-chromatic / src / sequential-multi / rainbow.js View on Github external
import {cubehelix} from "d3-color";
import {interpolateCubehelixLong} from "d3-interpolate";

export var warm = interpolateCubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.50, 0.8));

export var cool = interpolateCubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, 0.8));

var c = cubehelix();

export default function(t) {
  if (t < 0 || t > 1) t -= Math.floor(t);
  var ts = Math.abs(t - 0.5);
  c.h = 360 * t - 100;
  c.s = 1.5 - 1.5 * ts;
  c.l = 0.8 - 0.9 * ts;
  return c + "";
}
github junkerm / specmate / bundles / specmate-ui-core / webcontent / lib / js / d3 / d3-ng2-service / node_modules / d3-scale / src / cubehelix.js View on Github external
import {cubehelix} from "d3-color";
import {interpolateCubehelixLong} from "d3-interpolate";

export default interpolateCubehelixLong(cubehelix(300, 0.5, 0.0), cubehelix(-240, 0.5, 1.0));
github d3 / d3-interpolate / src / cubehelixLong.js View on Github external
function cubehelix(a, b) {
    a = color(a);
    b = color(b);
    var ah = a.h,
        as = a.s,
        al = a.l,
        bh = b.h,
        bs = b.s,
        bl = b.l || 0;
    if (isNaN(ah)) ah = bh;
    if (isNaN(as)) as = bs;
    if (isNaN(al)) al = bl;
    bh = (bh - ah) || 0;
    bs = (bs - as) || 0;
    bl -= al;
    return function(t) {
      a.h = ah + bh * t;
      a.s = as + bs * t;

d3-color

Color spaces! RGB, HSL, Cubehelix, Lab and HCL (Lch).

ISC
Latest version published 3 years ago

Package Health Score

74 / 100
Full package analysis