diff --git a/dhall-docs/src/Dhall/data/assets/index.css b/dhall-docs/src/Dhall/data/assets/index.css index 35acd7fbe..706f24235 100644 --- a/dhall-docs/src/Dhall/data/assets/index.css +++ b/dhall-docs/src/Dhall/data/assets/index.css @@ -194,7 +194,7 @@ span.of-type-token { color: #EBEBEB; } -body.dark-mode { +.dark-mode body { background-color: #484848; } @@ -222,7 +222,6 @@ body.dark-mode { color: #D4D4D4; } - .dark-mode a.copy-to-clipboard { color: #bdbdbd !important; } diff --git a/dhall-docs/src/Dhall/data/assets/index.js b/dhall-docs/src/Dhall/data/assets/index.js index ccb85a89a..23b310d3f 100644 --- a/dhall-docs/src/Dhall/data/assets/index.js +++ b/dhall-docs/src/Dhall/data/assets/index.js @@ -2,16 +2,15 @@ const DARK_MODE_OPT = 'dark-mode' const DARK_MODE_ACTIVE = 'dark-mode-active' const DARK_MODE_INACTIVE = 'dark-mode-inactive' +if (localStorage.getItem(DARK_MODE_OPT) == DARK_MODE_ACTIVE) { + document.documentElement.classList.add('dark-mode') +} + function onReady() { - if (localStorage.getItem(DARK_MODE_OPT) == DARK_MODE_ACTIVE) { - document.body.classList.add('dark-mode') - } else { - document.body.classList.remove('dark-mode') - } document.getElementById('switch-light-dark-mode') .addEventListener('click', () => { - document.body.classList.toggle('dark-mode') - if (document.body.classList.contains('dark-mode')) { + document.documentElement.classList.toggle('dark-mode') + if (document.documentElement.classList.contains('dark-mode')) { localStorage.setItem(DARK_MODE_OPT, DARK_MODE_ACTIVE) } else { localStorage.setItem(DARK_MODE_OPT, DARK_MODE_INACTIVE)