Public
Edited
Sep 14, 2022
1 fork
2 stars
Insert cell
Insert cell
color = withInvert(d3.scaleSequential(d3.interpolateRainbow).domain([100, 200]))
Insert cell
import { distance } from "@severo/color-distance"
Insert cell
withInvert = (color) => {
color.invert = (c) => {
c = d3.color(c);
return d3.least(color.ticks(256), (d) => distance(c, color(d)));
};
return color;
}
Insert cell
Insert cell
color.invert(color(150))
Insert cell
color.invert(color(50))
Insert cell
Insert cell
viewof c = Inputs.color({value: "#c0ffee"})
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