INNER CODE UNIT · JavaScript

getColor

sirius-ms/sirius · lcms2/viewer/viewer.js:125

  function getColor(index) {
    // Calculate hue based on the index
    const hue = (index * 137.508) % 360;

    // Set saturation and lightness to reasonable values
    const saturation = 70;
    const lightness = 60;

    // Convert HSL to RGB using D3.js
    const rgbColor = d3.hsl(hue, saturation, lightness).toString();

    return rgbColor;
}

  var parentMax = 0.0
  for (var i=0; i < data.parent.length; ++i) {
    parentMax = Math.max(parentMax, data.parent[i]);
  }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…