From 15a6a3720c9bed64aa2135f2ef48823e2a209d1c Mon Sep 17 00:00:00 2001 From: Yashash Gaurav Date: Wed, 29 Dec 2021 15:34:00 -0500 Subject: [PATCH] Adding functionality to choose light theme as default or not --- src/code.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/code.js b/src/code.js index f8015ba..8965be5 100644 --- a/src/code.js +++ b/src/code.js @@ -50,6 +50,9 @@ ${slugs /* Step 5: enter any custom scripts you'd like */ const CUSTOM_SCRIPT = \`${customScript || ''}\`; + + /* Step 6: choose default theme (light by default) */ + const LIGHT_THEME_BY_DEFAULT = true /* CONFIGURATION ENDS HERE */ @@ -258,7 +261,11 @@ ${slugs el.className = 'toggle-mode'; el.addEventListener('click', toggle); nav.appendChild(el); - onLight(); + if (\${LIGHT_THEME_BY_DEFAULT}) { + onLight(); + } else { + onDark(); + } } const observer = new MutationObserver(function() { if (redirected) return;