🏠 back to Observable

Dark mode indicator available to cells


#1

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


#2

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.