Public
Edited
Jul 31, 2023
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
colors = tidy.tidy(
colorsAll,
tidy.filter((d) => d.munsell.V == munsellValue),
tidy.mutate({
sRgb: (d) =>
_.flow([
colorUtils.linearRgbFromSRgb,
(x) => math.multiply(matCvd, x),
colorUtils.linearRgbToSRgb,
colorUtils.clampRgbGamut
])(d.sRgb),
space: (d) => {
const [L, a, b] = transitionInterpolate(spaceTrans, (space) =>
_.flow(
[colorSpaces[space].fromSRgb, colorSpaces[space].to100]
)(d.sRgb)
);
return { L, a, b };
},
hex: (d) => colorUtils.hexFromSRgb(d.sRgb)
})
)
Insert cell
transitionFilter(
transitionGenerator(viewof cvd.children[1], {
states: ["none", "protan", "deuteran", "tritan"]
}),
viewof transGenCvd
)
Insert cell
viewof transGenCvd = Inputs.input()
Insert cell
matCvd = transitionInterpolate(transGenCvd, (state) =>
matrixCvd(state, cvd.severity)
)
Insert cell
colorsAll = tidy.tidy(
colorUtils.munsellRenotation,
tidy.filter((d) => colorUtils.inRgbGamut(d.sRgb)),
tidy.mutate({
space: (d) => {
const [L, a, b] = transitionInterpolate(spaceTrans, (space) =>
_.flow(
[colorSpaces[space].fromSRgb, colorSpaces[space].to100]
)(d.sRgb)
);
return { L, a, b };
}
})
)
Insert cell
getDomain = function (d) {
return {
a: d3.extent(d.map((x) => x.space.a)),
b: d3.extent(d.map((x) => x.space.b))
};
}
Insert cell
domain = getDomain(colorsAll)
Insert cell
transitionFilter(
transitionGenerator(viewof space, {
states: Array.from(colorUtils.mapColorSpaces().values())
}),
viewof spaceTrans
)
Insert cell
viewof spaceTrans = Inputs.input()
Insert cell
Insert cell
Insert cell
Insert cell
math = import("https://cdn.skypack.dev/mathjs@11.8.2?")
Insert cell
tidy = import("https://unpkg.com/@tidyjs/tidy@2.5.2/dist/es/index.js?module")
Insert cell
Insert cell
Insert cell
Insert cell
import { changeTable } from "@ijlyttle/change-log"
Insert cell
import { inputCvd, matrixCvd } from "@ijlyttle/cvd-widget"
Insert cell
Insert cell
invokeMode(dark)
Insert cell
styleDark()
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