mirror of
https://github.com/daydreamer-json/ak-endfield-api-archive.git
synced 2026-04-05 23:22:20 +02:00
feat(pages): scaffold web documentation with parcel and custom fonts
This commit is contained in:
16
pages/src/assets/ts/essentials.ts
Normal file
16
pages/src/assets/ts/essentials.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'bootstrap';
|
||||
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||
import 'bootstrap-icons/font/bootstrap-icons.min.css';
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const setTheme = (theme: string) => {
|
||||
document.documentElement.setAttribute('data-bs-theme', theme);
|
||||
};
|
||||
const getPreferredTheme = (): 'light' | 'dark' => {
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||||
};
|
||||
setTheme(getPreferredTheme());
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
|
||||
setTheme(getPreferredTheme());
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user