Public
Edited
Apr 18, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mix= spectral.mix(start, end, mixFactor) // returns a new colour from the start and end colour
Insert cell
ramp(() => spectral.mix(start, end, mixFactor, )) // returning one value as above
Insert cell
ramp(c => spectral.mix(start, end, c)) // can't get the mix factor to work in this render
Insert cell
Insert cell
ramp(d3.interpolate(start, end))
Insert cell
ramp(d3.interpolate(start, mix))
Insert cell
ramp(d3.interpolate(mix, end))
Insert cell
Insert cell
ramp(d3.interpolateLab(start, end))
Insert cell
ramp(d3.interpolateLab(start, mix))
Insert cell
ramp(d3.interpolateLab(mix, end))
Insert cell
Insert cell
ramp(d3.interpolateHsl(start, end))
Insert cell
ramp(d3.interpolateHsl(start, mix))
Insert cell
ramp(d3.interpolateHsl(mix, end))
Insert cell
Insert cell
ramp(d3.interpolateHcl(start, end))
Insert cell
ramp(d3.interpolateHcl(start, mix))
Insert cell
ramp(d3.interpolateHcl(mix, end))
Insert cell
// pairs of colours from "A Dictionary of Colour Combinations" compiled by Sanzo Wada
sanzoWadaPairs = sets.filter(d => d.length === 2);
Insert cell
Insert cell
Insert cell
spectral = require("spectral.js@2")
Insert cell
import {ramp} from "@mbostock/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