diff --git a/docs/_static/js/theme_switcher.js b/docs/_static/js/theme_switcher.js new file mode 100644 index 00000000..3035b830 --- /dev/null +++ b/docs/_static/js/theme_switcher.js @@ -0,0 +1,38 @@ +const createThemeSwitcher = () => { + let btn = document.createElement('BUTTON'); + btn.className = 'theme-switcher'; + btn.id = 'themeSwitcher'; + btn.innerHTML = + ''; + document.body.appendChild(btn); + + if (localStorage.getItem('theme') === 'dark') $('#themeMoon').hide(0); + else $('#themeSun').hide(0); +}; + +$(document).ready(() => { + createThemeSwitcher(); + $('#themeSwitcher').click(switchTheme); + + $('footer').html( + $('footer').html() + ); +}); + +const switchTheme = () => { + if (localStorage.getItem('theme') === 'dark') { + localStorage.setItem('theme', 'light'); + document.documentElement.setAttribute('data-theme', 'light'); + + $('#themeSun').fadeOut(400, () => { + $('#themeMoon').fadeIn(400); + }); + } else { + localStorage.setItem('theme', 'dark'); + document.documentElement.setAttribute('data-theme', 'dark'); + + $('#themeMoon').fadeOut(400, () => { + $('#themeSun').fadeIn(400); + }); + } +}; diff --git a/docs/conf.py b/docs/conf.py index df4948a7..c0c1f45e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -132,6 +132,9 @@ # or fully qualified paths (eg. https://...) html_css_files = ['css/custom.css'] +html_js_files = [ + 'js/theme_switcher.js'] + # Custom sidebar templates, must be a dictionary that maps document names # to template names. # diff --git a/docs/content/bindings.rst b/docs/content/bindings.rst index 834ce56a..a2f08a23 100644 --- a/docs/content/bindings.rst +++ b/docs/content/bindings.rst @@ -7,7 +7,7 @@ Controller Bindings pcl.rst deadzones.rst -.. figure:: media/bindings.png +.. image:: media/bindings.png :width: 100% :align: center :alt: bindings window \ No newline at end of file diff --git a/docs/content/deadzones.rst b/docs/content/deadzones.rst index 37a8d694..72ce2ccd 100644 --- a/docs/content/deadzones.rst +++ b/docs/content/deadzones.rst @@ -1,7 +1,7 @@ Deadzones ========= -.. figure:: media/deadzones.png +.. image:: media/deadzones.png :width: 100% :align: center :alt: deadzones.png diff --git a/docs/content/io.rst b/docs/content/io.rst index 041f28c2..9a2e8163 100644 --- a/docs/content/io.rst +++ b/docs/content/io.rst @@ -1,7 +1,7 @@ Audio IO ======== -.. figure:: media/io.png +.. image:: media/io.png :width: 100% :align: center :alt: io.png diff --git a/docs/content/main.rst b/docs/content/main.rst index 4590d27e..7f67d448 100644 --- a/docs/content/main.rst +++ b/docs/content/main.rst @@ -3,7 +3,7 @@ SousaFX Main Window This window displays SousaFX's signalflow. -.. figure:: media/main.gif +.. image:: media/main.gif :align: center :width: 100% :alt: main.gif diff --git a/docs/content/midi.rst b/docs/content/midi.rst index 5e2f6c2d..28adcb21 100644 --- a/docs/content/midi.rst +++ b/docs/content/midi.rst @@ -1,7 +1,7 @@ MIDI Preferences ================ -.. figure:: media/midi.png +.. image:: media/midi.png :width: 100% :align: center :alt: midi \ No newline at end of file diff --git a/docs/content/modparms.rst b/docs/content/modparms.rst index 054e78b8..d147377b 100644 --- a/docs/content/modparms.rst +++ b/docs/content/modparms.rst @@ -1,7 +1,7 @@ Modulation Parameters ===================== -.. figure:: media/LPFmod.png +.. image:: media/LPFmod.png :width: 100% :align: center :alt: mod parms \ No newline at end of file diff --git a/docs/content/pcl.rst b/docs/content/pcl.rst index 22d39e30..a12df765 100644 --- a/docs/content/pcl.rst +++ b/docs/content/pcl.rst @@ -1,7 +1,7 @@ Parameter Control Logic ======================= -.. figure:: media/param-control-logic.png +.. image:: media/param-control-logic.png :width: 100% :align: center :alt: param-control-logic.png \ No newline at end of file diff --git a/docs/content/purchase.rst b/docs/content/purchase.rst index 9581a687..f49778bf 100644 --- a/docs/content/purchase.rst +++ b/docs/content/purchase.rst @@ -47,7 +47,7 @@ When you complete your purchase, a license key will be emailed to you ASAP (usua Classroom licenses and discounted-to-commercial license upgrades are also offered. For these and any other license needs, please email sousastep@gmail.com -.. figure:: media/window-about-nolicense.png +.. image:: media/window-about-nolicense.png :width: 90% :align: center :alt: window-about-nolicense.png diff --git a/docs/index.rst b/docs/index.rst index a8258a65..d3cd663f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,7 +1,7 @@ SousaFX Documentation ===================== -.. figure:: content/media/synesthesia.gif +.. image:: content/media/synesthesia.gif :width: 60% :align: center :alt: Work In Progress