A section of the Lab color space.
Last active
January 30, 2017 02:34
-
-
Save syntagmatic/97f4c653539f910a2f80c36647768bd3 to your computer and use it in GitHub Desktop.
Lab Color Space
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
</style> | |
<body> | |
<canvas id="painting" width=960 height=500> | |
<script src="https://d3js.org/d3.v4.0.0-alpha.45.js"></script> | |
<script src="https://d3js.org/d3-hsv.v0.0.js"></script> | |
<script src="https://d3js.org/d3-scale-chromatic.v0.3.js"></script> | |
<script> | |
var canvas = document.getElementById("painting"); | |
var ctx = canvas.getContext("2d"); | |
d3.range(0, canvas.width).forEach(function(x) { | |
d3.range(0, canvas.height).forEach(function(y) { | |
ctx.fillStyle = d3.lab(65, -100+200*x/canvas.width, -100+200*y/canvas.height); | |
ctx.fillRect(x, y, 1, 1); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment