Skip to content

Commit

Permalink
Merge pull request #6 from TeamGalena/main
Browse files Browse the repository at this point in the history
  • Loading branch information
PssbleTrngle authored Sep 23, 2024
2 parents f46f183 + f98af82 commit 53e7c9f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/assets/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions docs/assets/icon_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions docs/scripts/favicon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function setFavicon(dark) {
console.log({ dark });

const favicon = document.querySelector('link[rel="icon"]');
const name = dark ? "icon_dark" : "icon";
favicon.href = `/assets/${name}.svg`;
}

document$.subscribe(() => {
const query = window.matchMedia("(prefers-color-scheme: dark)");

setFavicon(query.matches);

query.addEventListener("change", (event) => {
setFavicon(event.matches);
});
});
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ plugins:

extra_css:
- styles/extra.css
extra_javascript:
- scripts/favicon.js

0 comments on commit 53e7c9f

Please sign in to comment.