From 350809a71659f6aec9f24f98699c82ebfcdab143 Mon Sep 17 00:00:00 2001 From: Naman Sood Date: Wed, 11 May 2022 01:02:39 -0400 Subject: [PATCH] completely overhaul dark mode to fix clapper Signed-off-by: Naman Sood --- css/style.css | 35 ++++++++++++++++++++--------------- css/style.scss | 42 ++++++++++++++++++++++++++---------------- js/script.js | 5 ++++- 3 files changed, 50 insertions(+), 32 deletions(-) diff --git a/css/style.css b/css/style.css index e65c240..56c9b82 100644 --- a/css/style.css +++ b/css/style.css @@ -11,34 +11,39 @@ body { font-family: "Nunito", sans-serif; } -body.dark-mode { - filter: invert(100%); -} -body.dark-mode .image-container img { - filter: invert(100%); -} -body.dark-mode .clapper { - filter: invert(100%); -} body.dark-mode .bg { opacity: 0 !important; } +body.dark-mode .main h1 { + color: #ddd; +} +body.dark-mode .main em { + color: #ddd; +} +body.dark-mode .main a { + color: #ddd; +} +body.dark-mode .main a:before, body.dark-mode .main a:after { + background: rgba(221, 221, 221, 0.2); +} body.dark-mode section:nth-child(even), body.dark-mode footer:nth-child(even) { - background: #eee !important; + background: #111 !important; + color: white; } body.dark-mode section:nth-child(odd), body.dark-mode footer:nth-child(odd) { - background: white !important; + background: #000 !important; + color: white; } body.dark-mode .works-card .text-container { - color: #333 !important; + color: #ddd !important; } body.dark-mode .works-card .text-container a { color: inherit !important; - background: rgba(0, 0, 0, 0.1) !important; + background: rgba(255, 255, 255, 0.1) !important; box-shadow: none !important; } body.dark-mode footer { - color: #333 !important; + color: #ddd !important; } .main { @@ -198,7 +203,7 @@ body.dark-mode footer { height: 0.33rem; width: 0.33rem; transform: rotate(45deg); - border: 1px solid black; + border: 1px solid; border-bottom: 0; border-left: 0; line-height: 1.2rem; diff --git a/css/style.scss b/css/style.scss index b35b78a..a155be7 100644 --- a/css/style.scss +++ b/css/style.scss @@ -12,40 +12,50 @@ body { } body.dark-mode { - filter: invert(100%); - - .image-container img { - filter: invert(100%); - } - - .clapper { - filter: invert(100%); - } - .bg { opacity: 0 !important; } + .main { + h1 { + color: #ddd; + } + + em { + color: #ddd; + } + + a { + color: #ddd; + + &:before, &:after { + background: rgba(#ddd, 0.2); + } + } + } + section:nth-child(even), footer:nth-child(even) { - background: #eee !important; + background: #111 !important; + color: white; } section:nth-child(odd), footer:nth-child(odd) { - background: white !important; + background: #000 !important; + color: white; } .works-card .text-container { - color: #333 !important; + color: #ddd !important; a { color: inherit !important; - background: rgba(0,0,0,0.1) !important; + background: rgba(255,255,255,0.1) !important; box-shadow: none !important; } } footer { - color: #333 !important; + color: #ddd !important; } } @@ -226,7 +236,7 @@ body.dark-mode { height: 0.33rem; width: 0.33rem; transform: rotate(45deg); - border: 1px solid rgba(black, 1); + border: 1px solid; border-bottom: 0; border-left: 0; line-height: 1.2rem; diff --git a/js/script.js b/js/script.js index bd0a4d3..4d716f4 100644 --- a/js/script.js +++ b/js/script.js @@ -160,7 +160,10 @@ function Point() { this.draw = function() { if(p.progress >= 0) { // opacity of of dot changes with progress - ctx.fillStyle = 'rgba(0,0,0,' + Math.sqrt(p.progress*0.005) + ')'; + const isDarkMode = document.body.classList.contains('dark-mode'); + let color = isDarkMode ? 255 : 0; + let multiplier = isDarkMode ? 0.05 : 0.005; + ctx.fillStyle = `rgba(${color}, ${color}, ${color}, ${Math.sqrt(p.progress*multiplier)})`; ctx.beginPath(); // radius calculation: maps progress from [0, 1] to [0, pi], // then takes sine of that to get an increase, then decrease