🏠 back to Observable

Dark mode indicator available to cells


A predefined boolean variable indicating whether dark mode is enabled would allow adapting some aspects of the notebook (mostly color schemes).


For now, you can test on document.body.classList.contains("observablehq--dark"). This is demonstrated at the end of “Designing for dark mode”, though there’s also a warning that this may change.