Published
Edited
Jun 11, 2022
Importers
3 stars
Insert cell
Insert cell
icon("play", "material")
Insert cell
icon("square.and.arrow.up")
Insert cell
function icon(name, set = "symbols") {
let unicode = "";

if (set === "symbols") {
unicode = l[name];
}
if (set === "material") {
const u1 = parseInt(l2[name], 16);
unicode = String.fromCodePoint(u1);
}
return html`<style>
@font-face {
font-family: "Symbols";
font-weight: 500;
font-style: normal;
src: url("${u}") format("woff2");
}

@font-face {
font-family: "Material Icons";
src: url("${u2}");
font-weight: normal;
font-style: normal;
}
.symbols {
font-family: "Symbols";
font-style: normal;
}
.material {
font-family: "Material Icons";
font-style: normal;
}
</style><i class="${set}">${unicode}<i/>`;
}
Insert cell
u = await FileAttachment("symbols.woff2").url()
Insert cell
u2 = await FileAttachment("material-icons.woff2").url()
Insert cell
l = await FileAttachment("symbols.json").json();
Insert cell
l2 = await FileAttachment("icons.json").json();
Insert cell
import {html} from "@observable/htl"
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