mirror of
https://github.com/aljazceru/njump.git
synced 2026-01-10 01:54:31 +01:00
Add dark mode support to embedded notes
This commit is contained in:
@@ -39,5 +39,11 @@
|
||||
iframe.contentWindow.postMessage({showGradient: true}, '*');
|
||||
}
|
||||
}
|
||||
|
||||
const darkModeQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
if (darkModeQuery.matches) {
|
||||
// Dark mode is preferred
|
||||
iframe.contentWindow.postMessage({setDarkMode: true}, '*');
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -102,12 +102,15 @@
|
||||
var gradient = document.getElementById('bottom-gradient')
|
||||
gradient.classList.remove('hidden')
|
||||
}
|
||||
if (event.data.setDarkMode) {
|
||||
document.querySelector('html').classList.add('theme--dark')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<div
|
||||
id="bottom-gradient"
|
||||
class="pointer-events-none sticky bottom-0 left-0 hidden h-20 w-full bg-gradient-to-b from-transparent to-white"
|
||||
class="pointer-events-none sticky bottom-0 left-0 hidden h-20 w-full bg-gradient-to-b from-transparent to-white dark:to-neutral-900"
|
||||
></div>
|
||||
|
||||
<img
|
||||
|
||||
Reference in New Issue
Block a user