theme: switch color on OS color scheme change #745

- Mermaid
- Chroma
This commit is contained in:
Sören Weber 2023-12-03 18:16:04 +01:00
parent 7c97f7b610
commit 3dc2f9a629
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

@ -1478,6 +1478,14 @@ function updateTheme( detail ){
}));
}
(function(){
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
initChroma( true );
initMermaid( true );
initOpenapi( true );
});
})();
function useMermaid( config ){
if( !Object.assign ){
// We don't support Mermaid for IE11 anyways, so bail out early
@ -1665,9 +1673,3 @@ ready( function(){
moveTopbarButtons();
adjustEmptyTopbarContents();
})();
(function(){
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
initOpenapi( true );
});
})();