diff --git a/app/static/js/scripts.js b/app/static/js/scripts.js index e74bd820..8866ab2f 100644 --- a/app/static/js/scripts.js +++ b/app/static/js/scripts.js @@ -7,6 +7,7 @@ document.addEventListener("DOMContentLoaded", function () { setupSubmitOnInputChange(); setupTimeTracking(); setupMobileNav(); + setupLightDark(); }); @@ -23,6 +24,19 @@ function setupMobileNav() { }); } +function setupLightDark() { + const elem = document.getElementById('light_mode'); + elem.addEventListener("click", function(event) { + setTheme('light') + setStoredTheme('light') + }); + const elem2 = document.getElementById('dark_mode'); + elem2.addEventListener("click", function(event) { + setTheme('dark') + setStoredTheme('dark') + }); +} + function toggleClass(elementId, className) { var element = document.getElementById(elementId); diff --git a/app/static/scss/_colours.scss b/app/static/scss/_colours.scss index 2cb20634..5e222a06 100644 --- a/app/static/scss/_colours.scss +++ b/app/static/scss/_colours.scss @@ -5,6 +5,7 @@ $green-hover: #83f188; $light-grey: #ddd; $grey: #bbb; $dark-grey: #777; +$super-dark-grey: #424549; .red { color: red; diff --git a/app/static/scss/_typography.scss b/app/static/scss/_typography.scss index bfe4eec5..f1090fde 100644 --- a/app/static/scss/_typography.scss +++ b/app/static/scss/_typography.scss @@ -222,6 +222,14 @@ content: "\e91f"; } +.fe-sun::before { + content: "\e9d7"; +} + +.fe-moon::before { + content: "\e99a"; +} + h1 { .fe-bell, .fe-no-bell { font-size: 18px; diff --git a/app/static/structure.css b/app/static/structure.css index cc809f91..ea0fc016 100644 --- a/app/static/structure.css +++ b/app/static/structure.css @@ -250,6 +250,14 @@ nav, etc which are used site-wide */ content: "\e91f"; } +.fe-sun::before { + content: "\e9d7"; +} + +.fe-moon::before { + content: "\e99a"; +} + h1 .fe-bell, h1 .fe-no-bell { font-size: 18px; top: -5px; @@ -610,6 +618,17 @@ fieldset legend { padding-top: 0; } +[data-bs-theme=dark] .post_list .post_teaser { + border-bottom: solid 1px #424549; +} +[data-bs-theme=dark] .comments > .comment { + border-top-color: #424549; +} +[data-bs-theme=dark] .downarea-textarea .form-control { + background-color: #424549; + color: whitesmoke; +} + .post_body img { max-height: 40vh; max-width: 100%; diff --git a/app/static/structure.scss b/app/static/structure.scss index a35c498a..4d79f826 100644 --- a/app/static/structure.scss +++ b/app/static/structure.scss @@ -250,6 +250,24 @@ nav, etc which are used site-wide */ } } + +[data-bs-theme=dark] { + .post_list .post_teaser { + border-bottom: solid 1px $super-dark-grey; + } + + .comments > .comment { + border-top-color: $super-dark-grey; + } + + .downarea-textarea { + .form-control { + background-color: $super-dark-grey; + color: whitesmoke; + } + } +} + .post_body { img { max-height: 40vh; diff --git a/app/static/styles.css b/app/static/styles.css index f680e56e..725f9fb9 100644 --- a/app/static/styles.css +++ b/app/static/styles.css @@ -249,6 +249,14 @@ content: "\e91f"; } +.fe-sun::before { + content: "\e9d7"; +} + +.fe-moon::before { + content: "\e99a"; +} + h1 .fe-bell, h1 .fe-no-bell { font-size: 18px; top: -5px; @@ -383,12 +391,9 @@ fieldset legend { body { font-size: 0.95rem; - background-color: #fbfdfe; - color: #495057; } nav.navbar { - background-color: #fff !important; border-bottom: 1px solid rgba(0, 40, 100, 0.12); min-height: 60px; } @@ -398,7 +403,6 @@ nav.navbar { } .navbar-light .navbar-nav .nav-link { - color: rgba(0, 0, 0, 0.8); outline-style: none; } @@ -474,7 +478,6 @@ nav.navbar { .main_pane { border: solid 1px #ddd; border-radius: 5px; - background-color: white; padding-top: 8px; padding-bottom: 12px; } @@ -487,6 +490,10 @@ nav.navbar { height: auto; } +[data-bs-theme=dark] .main_pane { + border-color: #424549; +} + .community_icon { width: 20vw; height: 20vw; @@ -627,31 +634,21 @@ nav.navbar { color: black; } -@media (prefers-color-scheme: dark) { - body { - background-color: #777; +@media (min-width: 992px) { + .h1, h1 { + font-size: 2rem; } +} - nav.navbar { - background-color: #eee !important; +@media (min-width: 992px) { + .h2, h2 { + font-size: 1.8rem; } +} - .main_pane, .card { - background-color: #eee; - } - - .btn-outline-secondary { - border-color: #eee; - color: #eee; - } - - .main_pane .btn-outline-secondary { - border-color: #777; - color: #777; - } - - footer a { - color: #eee; +@media (min-width: 992px) { + .h3, h3 { + font-size: 1.6rem; } } diff --git a/app/static/styles.scss b/app/static/styles.scss index 3bba1f7d..c6f5d3ab 100644 --- a/app/static/styles.scss +++ b/app/static/styles.scss @@ -6,12 +6,9 @@ body { font-size: 0.95rem; - background-color: #fbfdfe; - color: #495057; } nav.navbar { - background-color: #fff!important; border-bottom: 1px solid rgba(0, 40, 100, 0.12); min-height: 60px; } @@ -22,7 +19,6 @@ nav.navbar { } } .navbar-light .navbar-nav .nav-link { - color: rgba(0,0,0,.8); outline-style: none; } @@ -98,7 +94,6 @@ nav.navbar { .main_pane { border: solid 1px $light-grey; border-radius: 5px; - background-color: white; padding-top: 8px; padding-bottom: 12px; @@ -113,6 +108,10 @@ nav.navbar { } } +[data-bs-theme=dark] .main_pane { + border-color: $super-dark-grey; +} + .community_icon { width: 20vw; height: 20vw; @@ -267,35 +266,20 @@ nav.navbar { color: black; } -@media (prefers-color-scheme: dark) { - - body { - background-color: $dark-grey; +.h1, h1 { + @include breakpoint(tablet) { + font-size: 2rem; } +} - nav.navbar { - background-color: #eee!important; +.h2, h2 { + @include breakpoint(tablet) { + font-size: 1.8rem; } +} - .main_pane, .card { - background-color: #eee; +.h3, h3 { + @include breakpoint(tablet) { + font-size: 1.6rem; } - - .btn-outline-secondary { - border-color: #eee; - color: #eee; - } - - .main_pane { - .btn-outline-secondary { - border-color: $dark-grey; - color: $dark-grey; - } - } - - footer { - a { - color: #eee; - } - } -} \ No newline at end of file +} diff --git a/app/templates/base.html b/app/templates/base.html index 7a943865..9e38cc1f 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -66,12 +66,34 @@ {% if rss_feed %} {% endif %} + {% endblock %}
{% block navbar %} -