From 3dc2f9a629820ab3a6fd736950e2ee31af1c7480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sun, 3 Dec 2023 18:16:04 +0100 Subject: [PATCH] theme: switch color on OS color scheme change #745 - Mermaid - Chroma --- static/js/theme.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/static/js/theme.js b/static/js/theme.js index e868406832..4c9cbb6193 100644 --- a/static/js/theme.js +++ b/static/js/theme.js @@ -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 ); - }); -})();