Public
Edited
Sep 21, 2023
Insert cell
Insert cell
import { slider } from "@jashkenas/inputs"
Insert cell
import { html } from "@observablehq/htl"
Insert cell
Dimension = class {
constructor(level) {
this.level = level;
}
}
Insert cell
getVerse = (level) => {
switch (
level
// ... [The switch-case code from before]
) {
}
}
Insert cell
getBackgroundColor = (level) => {
let colors = [
"#E57373",
"#BA68C8",
"#7986CB",
"#64B5F6",
"#4FC3F7",
"#4DB6AC",
"#81C784",
"#DCE775",
"#FFD54F",
"#FF8A65"
];
return colors[level - 10];
}
Insert cell
dimensionSlider = slider({
min: 10,
max: 19,
value: 10,
step: 1,
title: "Dimension"
})
Insert cell
dimension = dimensionSlider.value
Insert cell
{
verse = getVerse(dimension);
backgroundColor = getBackgroundColor(dimension);
}
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