pages/assets/js/distillpub/overrides.js
Ivan Puhachov a5508c734b
Fix distill darkmode (#299)
* updating distill post to show fixes done

* fix for colors in numerated lists and tables

* fixing blockquotes

* fixing colors in math, footnotes, references, hover boxes, code highlights

* Add example distill overrides

* reverted back changes in distill template.v2.js

Co-authored-by: Maruan Al-Shedivat <alshedivat.maruan@gmail.com>
2021-07-04 20:27:39 -04:00

20 lines
1.2 KiB
JavaScript

$(document).ready(function() {
// Override styles of the footnotes.
document.querySelectorAll("d-footnote").forEach(function(footnote) {
footnote.shadowRoot.querySelector("sup > span")
.setAttribute("style", "color: var(--global-theme-color);");
footnote.shadowRoot.querySelector("d-hover-box").shadowRoot.querySelector("style").sheet
.insertRule(".panel {background-color: var(--global-bg-color) !important;}");
});
// Override styles of the citations.
document.querySelectorAll("d-cite").forEach(function(cite) {
cite.shadowRoot.querySelector("div > span")
.setAttribute("style", "color: var(--global-theme-color);");
cite.shadowRoot.querySelector("style").sheet
.insertRule("ul li a {color: var(--global-text-color) !important; text-decoration: none;}");
cite.shadowRoot.querySelector("style").sheet
.insertRule("ul li a:hover {color: var(--global-theme-color) !important;}");
cite.shadowRoot.querySelector("d-hover-box").shadowRoot.querySelector("style").sheet
.insertRule(".panel {background-color: var(--global-bg-color) !important;}");
});
})