Get started with d3-color CDN

BSD-3-Clause licensed

D3-Color: library for manipulating and converting colors in D3.js data visualization.

Tags:
  • d3
  • d3-module
  • color
  • rgb
  • hsl
  • lab
  • hcl
  • lch
  • cubehelix

Stable version

Copied!

How to start using d3-color CDN


<!DOCTYPE html>
<html>
<head>
  <script src="https://d3js.org/d3.v6.min.js"></script>
  <script src="https://cdn.cdnhub.io/d3-color/3.1.0/d3-color.min.js"></script>
  <title>Get started with d3-color CDN - cdnhub.io</title>
  <style>
    #circle {
      fill: none;
      stroke-width: 2px;
    }
  </style>
</head>
<body>
  <svg width="100" height="100">
    <circle id="circle" cx="50" cy="50" r="45" />
  </svg>
  <script>
    const color = d3.color("#FFA07A"); // Set color
    d3.select("#circle")
      .attr("stroke", color); // Apply color to the circle
  </script>
</body>
</html>

All versions