mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 01:33:04 +00:00
openapi: switch color on OS color scheme change #745
This commit is contained in:
parent
8cca74e3e6
commit
3df6c1bde7
2 changed files with 9 additions and 0 deletions
|
@ -36,5 +36,8 @@
|
|||
// we have to wait until the CSS class .default-animation has settled and and the buttons have loaded to recalculate the scheme again
|
||||
setTimeout( githubButtonsInit, 400 );
|
||||
});
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
|
||||
setTimeout( githubButtonsInit, 400 );
|
||||
});
|
||||
</script>
|
||||
<script async src="{{"js/github-buttons.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
|
@ -1665,3 +1665,9 @@ ready( function(){
|
|||
moveTopbarButtons();
|
||||
adjustEmptyTopbarContents();
|
||||
})();
|
||||
|
||||
(function(){
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
|
||||
initOpenapi( true );
|
||||
});
|
||||
})();
|
||||
|
|
Loading…
Reference in a new issue