Published
Edited
Feb 23, 2022
1 fork
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof method = Inputs.select(['Brightness', 'Hue', 'Saturation'], {value: "Brightness", label: "Method"})
Insert cell
Insert cell
Insert cell
note = {
if (method=='Brightness') {
let brightness = pixel_color.r+pixel_color.g+pixel_color.b;
return c_scale[Math.floor((c_scale.length-1)*brightness/(255*3))];
} else if (method == 'Hue') {
let hue = pixel_hsl.h;
return c_scale[Math.floor((c_scale.length-1)*hue/(360))];
} else if (method == 'Saturation') {
let sat = pixel_hsl.s;
return c_scale[Math.floor((c_scale.length-1)*sat)];
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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