diff options
author | David Luevano Alvarado <david@luevano.xyz> | 2021-03-18 00:23:57 -0700 |
---|---|---|
committer | David Luevano Alvarado <david@luevano.xyz> | 2021-03-18 00:23:57 -0700 |
commit | 3c10d209d706c286817e7150595113d9cda444bd (patch) | |
tree | 83f24325544855c64306c01f54cce31731b59f4a /static/scripts | |
parent | f8ae4d47bd7f3c0534822a78be8f0654195c4e1a (diff) |
Add highligh.js
Diffstat (limited to 'static/scripts')
-rw-r--r-- | static/scripts/theme.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/static/scripts/theme.js b/static/scripts/theme.js index 4bfa68e..68a0cbb 100644 --- a/static/scripts/theme.js +++ b/static/scripts/theme.js @@ -16,10 +16,14 @@ window.onload = () => { switch_theme.checked = false; let theme = document.getElementById('theme-css'); + let code_theme = document.getElementById('code-theme-css'); let href = theme.getAttribute('href'); + let code_href = code_theme.getAttribute('href'); href = href.replace('dark.css', 'light.css'); + code_href = code_href.replace('solarized-dark.min.css', 'solarized-light.min.css'); theme.setAttribute('href', href); + code_theme.setAttribute('href', code_href); } } @@ -39,18 +43,23 @@ function setTheme(){ // toggles between both themes, and then calls set theme to actually set it persistently. function toggleTheme(){ let theme = document.getElementById('theme-css'); + let code_theme = document.getElementById('code-theme-css'); let href = theme.getAttribute('href'); + let code_href = code_theme.getAttribute('href'); if(href.endsWith('dark.css')){ href = href.replace('dark.css', 'light.css'); + code_href = code_href.replace('solarized-dark.min.css', 'solarized-light.min.css'); } else if (href.endsWith('light.css')){ href = href.replace('light.css', 'dark.css'); + code_href = code_href.replace('solarized-light.min.css', 'solarized-dark.min.css'); } else{ console.log('Wrong replacement.'); } theme.setAttribute('href', href); + code_theme.setAttribute('href', code_href); setTheme(); } |