style: improve docs branding and header
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<script is:inline>
|
||||
(() => {
|
||||
const preference = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
|
||||
const applySystemTheme = () => {
|
||||
const theme = preference.matches ? 'dark' : 'light';
|
||||
document.documentElement.dataset.theme = theme;
|
||||
document.documentElement.style.colorScheme = theme;
|
||||
};
|
||||
|
||||
try {
|
||||
localStorage.removeItem('starlight-theme');
|
||||
} catch {
|
||||
// The system preference still works when storage is unavailable.
|
||||
}
|
||||
|
||||
applySystemTheme();
|
||||
preference.addEventListener?.('change', applySystemTheme);
|
||||
})();
|
||||
</script>
|
||||
Reference in New Issue
Block a user