Published unlisted
Edited
Jun 5, 2019
Insert cell
Insert cell
Insert cell
a = ({ color: "red" })
Insert cell
b = ({ color: "lightblue" })
Insert cell
interpolator = d3.interpolate(a, b)
Insert cell
interpolator(0.5)
Insert cell
ramp(t => interpolator(t).color) // default hard-coded _rgb_ method; greyish
Insert cell
ramp(d3.interpolateRgb.gamma(0.7)(a.color, b.color)) // arguably better
Insert cell
ramp(d3.interpolateLab(a.color, b.color)) // tasty
Insert cell
ramp(d3.interpolateHclLong(a.color, b.color)) // funky
Insert cell
d3 = require("d3@5")
Insert cell
import {ramp} from "@mbostock/color-ramp"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more