openapi: switch color on OS color scheme change #745

This commit is contained in:
Sören Weber 2023-12-03 15:25:30 +01:00
parent 8cca74e3e6
commit 3df6c1bde7
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
2 changed files with 9 additions and 0 deletions

View file

@ -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 // 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 ); setTimeout( githubButtonsInit, 400 );
}); });
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
setTimeout( githubButtonsInit, 400 );
});
</script> </script>
<script async src="{{"js/github-buttons.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script> <script async src="{{"js/github-buttons.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>

View file

@ -1665,3 +1665,9 @@ ready( function(){
moveTopbarButtons(); moveTopbarButtons();
adjustEmptyTopbarContents(); adjustEmptyTopbarContents();
})(); })();
(function(){
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
initOpenapi( true );
});
})();