From d435f9d03b754c4cd7c9dd320221259aa2ee49b0 Mon Sep 17 00:00:00 2001 From: Jake Date: Tue, 8 Jun 2021 14:34:19 -0700 Subject: [PATCH] fix for flicker on load --- assets/js/theme-switch.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/assets/js/theme-switch.js b/assets/js/theme-switch.js index dd83c0dcd2..6e197aa443 100644 --- a/assets/js/theme-switch.js +++ b/assets/js/theme-switch.js @@ -1,7 +1,7 @@ // Check user prefers color, toggle light/dark, save state // Based partly on https://github.com/vinorodrigues/bootstrap-dark -$(document).ready(function() { + //////// NOTES // On mac the system will be either light, dark or auto. Auto will return either light or dark and NOT no preference. @@ -48,6 +48,8 @@ $(document).ready(function() { // update every time it changes if (window.matchMedia) window.matchMedia("(prefers-color-scheme: dark)").addListener( update_color_scheme_css ); + + $(document).ready(function() { // toggle button click code $("#css-toggle-btn").bind("click", function() {