How to use the d3.rgb function in d3

To help you get started, we’ve selected a few d3 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 dblarremore / webweb / client / js / node.js View on Github external
get outline() {
    if (this.matchesString || this.containsMouse) {
      return "black"
    }
    else {
      return d3.rgb(255, 255, 255)
    }
  }
github sandialabs / slycat / web-server / plugins / slycat-video-swarm / js / color-switcher 2.js View on Github external
var self = this;

    this.color_maps =
    {
      "night":
      {
        "label": "Night",
        "background":   d3.rgb(128, 128, 128),
        "background_2": d3.rgb(143,143,146),
        "foreground":   d3.rgb(255, 255, 255),
        "null_color": "rgb(75,75,75)",
        "opacity": "0.5",
        "colors":
        [
          d3.rgb( 59,  76, 192),
          d3.rgb( 68,  90, 204),
          d3.rgb( 77, 104, 215),
          d3.rgb( 87, 117, 225),
          d3.rgb( 98, 130, 234),
          d3.rgb(108, 142, 241),
          d3.rgb(119, 154, 247),
          d3.rgb(130, 165, 251),
          d3.rgb(141, 176, 254),
          d3.rgb(152, 185, 255),
          d3.rgb(163, 194, 255),
          d3.rgb(174, 201, 253),
          d3.rgb(184, 208, 249),
          d3.rgb(194, 213, 244),
          d3.rgb(204, 217, 238),
          d3.rgb(213, 219, 230),
          d3.rgb(221, 221, 221),
          d3.rgb(229, 216, 209),
github viz-centric / flair-visualizations / js / charts / map.js View on Github external
chart.update = function (data) {
        valueMapper = [];

        container.selectAll('.country').remove();

        data.forEach(function (d) {
            valueMapper[d[_dimension[0]]] = d[_measure[0]];
        });

        var countries = Object.keys(valueMapper);

        gradientColor.range([
            d3.rgb(_displayColor).brighter(),
            d3.rgb(_displayColor).darker()
        ])

        gradientColor.domain(d3.extent(data, function (d) {
            return d[_measure[0]];
        }));

        ready(Worldtopo, countries);

        if (!_print) {
            _local_svg.selectAll('path.country')
                .on('mouseover', _handleMouseOverFn.call(chart, tooltip, _local_svg))
                .on('mousemove', _handleMouseMoveFn.call(chart, tooltip, _local_svg))
                .on('mouseout', _handleMouseOutFn.call(chart, tooltip, _local_svg))
                .on('click', function (d, i) {
github sandialabs / slycat / web-server / plugins / slycat-parameter-image-plus-model / js / color-switcher.js View on Github external
d3.rgb(213,  80,  66),
          d3.rgb(203,  62,  56),
          d3.rgb(192,  40,  47),
          d3.rgb(180,   4,  38),
        ]
      },
    "day":
      {
        "label": "Day",
        "background": d3.rgb(255, 255, 255),
        "null_color": "gray",
        "opacity": "0.7",
        "colors":
        [
          d3.rgb(100, 108, 234),
          d3.rgb(115, 118, 240),
          d3.rgb(128, 128, 244),
          d3.rgb(140, 138, 248),
          d3.rgb(151, 147, 250),
          d3.rgb(161, 155, 251),
          d3.rgb(169, 163, 251),
          d3.rgb(177, 170, 250),
          d3.rgb(184, 177, 248),
          d3.rgb(189, 182, 245),
          d3.rgb(193, 187, 241),
          d3.rgb(197, 191, 236),
          d3.rgb(199, 194, 230),
          d3.rgb(200, 196, 224),
          d3.rgb(201, 198, 216),
          d3.rgb(200, 199, 208),
          d3.rgb(198, 198, 198),
          d3.rgb(210, 197, 195),
github sandialabs / slycat / web-server / js / slycat-color-maps.js View on Github external
opacity: "0.7",
      colors:
      [
        d3.rgb(100, 108, 234),
        d3.rgb(115, 118, 240),
        d3.rgb(128, 128, 244),
        d3.rgb(140, 138, 248),
        d3.rgb(151, 147, 250),
        d3.rgb(161, 155, 251),
        d3.rgb(169, 163, 251),
        d3.rgb(177, 170, 250),
        d3.rgb(184, 177, 248),
        d3.rgb(189, 182, 245),
        d3.rgb(193, 187, 241),
        d3.rgb(197, 191, 236),
        d3.rgb(199, 194, 230),
        d3.rgb(200, 196, 224),
        d3.rgb(201, 198, 216),
        d3.rgb(200, 199, 208),
        d3.rgb(198, 198, 198),
        d3.rgb(210, 197, 195),
        d3.rgb(220, 194, 192),
        d3.rgb(229, 191, 187),
        d3.rgb(236, 186, 181),
        d3.rgb(243, 181, 175),
        d3.rgb(248, 175, 168),
        d3.rgb(251, 168, 160),
        d3.rgb(254, 159, 152),
        d3.rgb(255, 150, 143),
        d3.rgb(255, 140, 133),
        d3.rgb(253, 129, 123),
        d3.rgb(250, 117, 112),
github govau / performance-dashboard / client / src / _dashboard-legacy / d3-charts-dto / lib / javascripts / index.js View on Github external
function createPoint(day, color) {
  return {
    altColor: d3.rgb(color).darker(0.85),
    altLineStyle: '12,5',
    color: color,
    id: 'data-0',
    name: 'data 0',
    x: new Date(`2015-12-${day}`),
    y: Math.random() * 100,
  };
}
github adobe / leonardo / packages / contrast-colors / index.js View on Github external
let Contrasts = d3.range(swatches).map((d) => {
    let rgbArray = [d3.rgb(scaleData.scale(d)).r, d3.rgb(scaleData.scale(d)).g, d3.rgb(scaleData.scale(d)).b];
    let baseRgbArray = [d3.rgb(base).r, d3.rgb(base).g, d3.rgb(base).b];
    let ca = contrast(rgbArray, baseRgbArray).toFixed(2);

    return Number(ca);
  });
github sandialabs / slycat / web-server / js / slycat-color-maps.js View on Github external
d3.rgb(100, 108, 234),
        d3.rgb(115, 118, 240),
        d3.rgb(128, 128, 244),
        d3.rgb(140, 138, 248),
        d3.rgb(151, 147, 250),
        d3.rgb(161, 155, 251),
        d3.rgb(169, 163, 251),
        d3.rgb(177, 170, 250),
        d3.rgb(184, 177, 248),
        d3.rgb(189, 182, 245),
        d3.rgb(193, 187, 241),
        d3.rgb(197, 191, 236),
        d3.rgb(199, 194, 230),
        d3.rgb(200, 196, 224),
        d3.rgb(201, 198, 216),
        d3.rgb(200, 199, 208),
        d3.rgb(198, 198, 198),
        d3.rgb(210, 197, 195),
        d3.rgb(220, 194, 192),
        d3.rgb(229, 191, 187),
        d3.rgb(236, 186, 181),
        d3.rgb(243, 181, 175),
        d3.rgb(248, 175, 168),
        d3.rgb(251, 168, 160),
        d3.rgb(254, 159, 152),
        d3.rgb(255, 150, 143),
        d3.rgb(255, 140, 133),
        d3.rgb(253, 129, 123),
        d3.rgb(250, 117, 112),
        d3.rgb(246, 105, 101),
        d3.rgb(240,  91,  90),
        d3.rgb(233,  75,  78),
github apache / incubator-superset / superset / assets / src / visualizations / Heatmap / Heatmap.js View on Github external
const y = yScale(d.y);
      pixs[x + (y * xScale.domain().length)] = c;
      if (matrix[x] === undefined) {
        matrix[x] = {};
      }
      if (matrix[x][y] === undefined) {
        matrix[x][y] = d;
      }
    });

    let p = -1;
    for (let i = 0; i < heatmapDim[0] * heatmapDim[1]; i++) {
      let c = pixs[i];
      let alpha = 255;
      if (c === undefined) {
        c = d3.rgb('#F00');
        alpha = 0;
      }
      image.data[++p] = c.r;
      image.data[++p] = c.g;
      image.data[++p] = c.b;
      image.data[++p] = alpha;
    }
    context.putImageData(image, 0, 0);
    imageObj.src = canvas.node().toDataURL();
  }
  createImageObj();
github logicalhan / rickshaw_rails / app / assets / javascripts / rickshaw.js View on Github external
var disabledColor = args.disabledColor || function(seriesColor) {
    return d3.interpolateRgb(seriesColor, d3.rgb('#d8d8d8'))(0.8).toString();
  };