This other example of pstuffa works well with D3(v4)
xxxxxxxxxx
<html>
<head>
<script src="https://d3js.org/d3.v3.min.js"></script>
<meta charset="utf-8">
<title>Categorical Colors</title>
</head>
<body>
<h1>d3 categorical colors & Google colors</h1>
<p>d3 category10</p>
<div id="c10"></div>
<p>google 10c</p>
<div id="g10c"></div>
<p>d3 category20</p>
<div id="c20"></div>
<p>d3 category20b</p>
<div id="c20b"></div>
<p>d3 category20c</p>
<div id="c20c"></div>
<p>google 20c</p>
<div id="g20c"></div>
<br><br><a href="https://github.com/mbostock/d3/wiki/Ordinal-Scales#categorical-colors">https://github.com/mbostock/d3/wiki/Ordinal-Scales#categorical-colors</a>
<script src="colores.js"></script>
</body>
</html>
Modified http://d3js.org/d3.v3.min.js to a secure url
https://d3js.org/d3.v3.min.js