Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to use HCL in d3.js
<!DOCTYPE html>
<meta charset="utf-8">
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
padding: 14px;
div {
width: 60px;
height: 60px;
float: left;
margin-right: 14px;
<script src=""></script>
<script src=""></script>
var data = [0,1,2,3,4,5,6,7,8,9,10];
var color = d3.scale.linear()
.domain([0,10]) // min/max of data
.range(["#FDFFCB", "#232942"])
.style("background", function(d) { return color(d) });

This comment has been minimized.

Copy link

felipesabino commented Nov 13, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.