Skip to content

Instantly share code, notes, and snippets.

@mforando
Created February 19, 2020 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mforando/750771042f15302abdc9c192e8ebee1f to your computer and use it in GitHub Desktop.
Save mforando/750771042f15302abdc9c192e8ebee1f to your computer and use it in GitHub Desktop.
Color Palette Reference
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://d3js.org/d3.v4.min.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
</style>
</head>
<div id="cont">
</div>
<body>
<script>
var divs = d3.select("#cont")
.selectAll(".colordivs")
.data(["#A05DA5","#2B92D0","#84A743","#5A514C","#F24F26","#8B827D","#EFAC41","#008465"])
divs.enter()
.append('div')
.attr('class', 'colordivs');
d3.selectAll('.colordivs')
.append('div')
.style('display', 'inline-block')
.style('background', (d)=>{return d})
.style('width', '15px')
.style('height', '15px').style('margin-right', '10px')
.style('border', '1px solid black');
d3.selectAll('.colordivs')
.append('div')
.style('display', 'inline-block')
.text((d)=>{return d})
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment