Published
Edited
Dec 3, 2018
1 fork
27 stars
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
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
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
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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
/**
* Converts an sRGB value to linear color space
* Assumes the value is in in the range [0-255]
*/
toLinear = function (c) {
c /= 255;
if (c > 0.04045)
return Math.pow(((c + 0.055) / 1.055), 2.4);
else
return c / 12.92;
}

Insert cell
/**
* Converts a linear value to sRGB value
* Assumes the value is in the range [0-1.0]
*/
tosRGB = function (c) {
if (c > 0.0031308) {
c = (1.055 * Math.pow(c, 1.0 / 2.4)) - 0.055;
return (c << 8) - c;
}
return c * 12.92 * 255;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
selectedImg = {
switch(imageSelectionMethod) {
case 'default':
return {
name: selectionNames[imageSelect],
url: selectionURLs[imageSelect],
};
case 'file':
return {
name: imageSelect ? imageSelect.name : selectionNames[0],
url: imageSelect ? await Files.url(imageSelect) : selectionURLs[0],
};
case 'url':
return {
name: "`Custom URL`",
url: imageSelect,
};
}
}
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
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
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
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more