mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
* Warning Removal * Flake Stuff * HotFix * Docs Fix * I'm Dumb * Docs Fix 2 * Fixing Github Requests * Fix * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * quick fix * Add Deprecation Warning * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Weird Pre Commit Stuff * Quick Fix * Quick Fix * Fix * Flake Fix * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
67 lines
1.8 KiB
JavaScript
67 lines
1.8 KiB
JavaScript
|
|
window.addEventListener("load", function () {
|
|
const styleElements = []
|
|
const colorSchemeQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
const diagrams = document.querySelectorAll("object.inheritance.graphviz");
|
|
|
|
for (let diagram of diagrams) {
|
|
style = document.createElement('style');
|
|
styleElements.push(style);
|
|
console.log(diagram);
|
|
diagram.contentDocument.firstElementChild.appendChild(style);
|
|
}
|
|
|
|
function setColorScheme(e) {
|
|
let colors, additions = "";
|
|
if (e.matches) {
|
|
// Dark
|
|
colors = {
|
|
text: "#e07a5f",
|
|
box: "#383838",
|
|
edge: "#d0d0d0",
|
|
background: "#131416"
|
|
};
|
|
} else {
|
|
// Light
|
|
colors = {
|
|
text: "#e07a5f",
|
|
box: "#fff",
|
|
edge: "#413c3c",
|
|
background: "#ffffff"
|
|
};
|
|
additions = `
|
|
.node polygon {
|
|
filter: drop-shadow(0 1px 3px #0002);
|
|
}
|
|
`
|
|
}
|
|
for (let style of styleElements) {
|
|
style.innerHTML = `
|
|
svg {
|
|
background-color: ${colors.background};
|
|
}
|
|
|
|
.node text {
|
|
fill: ${colors.text};
|
|
}
|
|
|
|
.node polygon {
|
|
fill: ${colors.box};
|
|
}
|
|
|
|
.edge polygon {
|
|
fill: ${colors.edge};
|
|
stroke: ${colors.edge};
|
|
}
|
|
|
|
.edge path {
|
|
stroke: ${colors.edge};
|
|
}
|
|
${additions}
|
|
`;
|
|
}
|
|
}
|
|
|
|
setColorScheme(colorSchemeQuery);
|
|
colorSchemeQuery.addEventListener("change", setColorScheme);
|
|
});
|