aboutsummaryrefslogtreecommitdiffstats
path: root/view/theme/redbasic/js/redbasic.js
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-01-20 11:05:15 +0000
committerMario <mario@mariovavti.com>2023-01-20 11:05:15 +0000
commit9dc949b62c6b5e3c8872211f71b11714d9d22b22 (patch)
tree38c06e7a128742e219eb74d6adb035f2f106918a /view/theme/redbasic/js/redbasic.js
parent40394b94d7c8a8bf1f61f5482195164fff434b90 (diff)
downloadvolse-hubzilla-9dc949b62c6b5e3c8872211f71b11714d9d22b22.tar.gz
volse-hubzilla-9dc949b62c6b5e3c8872211f71b11714d9d22b22.tar.bz2
volse-hubzilla-9dc949b62c6b5e3c8872211f71b11714d9d22b22.zip
native dark theme initial checkin
Diffstat (limited to 'view/theme/redbasic/js/redbasic.js')
-rw-r--r--view/theme/redbasic/js/redbasic.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js
index 04469cb85..7584f9421 100644
--- a/view/theme/redbasic/js/redbasic.js
+++ b/view/theme/redbasic/js/redbasic.js
@@ -2,6 +2,19 @@
* redbasic theme specific JavaScript
*/
+let redbasic_dark_mode = localStorage.getItem('redbasic_dark_mode');
+
+if (redbasic_dark_mode == 1) {
+ $('html').attr('data-bs-theme', 'light');
+ $('#theme-switch-icon').removeClass('fa-sun-o').addClass('fa-moon-o');
+}
+
+
+if (redbasic_dark_mode == 2) {
+ $('html').attr('data-bs-theme', 'dark');
+ $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o');
+}
+
$(document).ready(function() {
// CSS3 calc() fallback (for unsupported browsers)
@@ -40,6 +53,20 @@ $(document).ready(function() {
}
});
+ $('#theme-switch').click(function() {
+ if ($('html').attr('data-bs-theme') === 'dark') {
+ $('html').attr('data-bs-theme', 'light');
+ localStorage.setItem('redbasic_dark_mode', 1);
+ $('#theme-switch-icon').removeClass('fa-sun-o').addClass('fa-moon-o');
+ }
+ else {
+ $('html').attr('data-bs-theme', 'dark');
+ localStorage.setItem('redbasic_dark_mode', 2);
+ $('#theme-switch-icon').removeClass('fa-moon-o').addClass('fa-sun-o');
+ }
+ });
+
+
$('#menu-btn').click(function() {
if($('#navbar-collapse-1').hasClass('show')){
$('#navbar-collapse-1').removeClass('show');