completely overhaul dark mode to fix clapper

Signed-off-by: Naman Sood <mail@nsood.in>
This commit is contained in:
Naman Sood 2022-05-11 01:02:39 -04:00
parent ea81f7aeef
commit 350809a716
3 changed files with 50 additions and 32 deletions

View file

@ -11,34 +11,39 @@ body {
font-family: "Nunito", sans-serif; 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 { body.dark-mode .bg {
opacity: 0 !important; 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) { 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) { 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 { body.dark-mode .works-card .text-container {
color: #333 !important; color: #ddd !important;
} }
body.dark-mode .works-card .text-container a { body.dark-mode .works-card .text-container a {
color: inherit !important; color: inherit !important;
background: rgba(0, 0, 0, 0.1) !important; background: rgba(255, 255, 255, 0.1) !important;
box-shadow: none !important; box-shadow: none !important;
} }
body.dark-mode footer { body.dark-mode footer {
color: #333 !important; color: #ddd !important;
} }
.main { .main {
@ -198,7 +203,7 @@ body.dark-mode footer {
height: 0.33rem; height: 0.33rem;
width: 0.33rem; width: 0.33rem;
transform: rotate(45deg); transform: rotate(45deg);
border: 1px solid black; border: 1px solid;
border-bottom: 0; border-bottom: 0;
border-left: 0; border-left: 0;
line-height: 1.2rem; line-height: 1.2rem;

View file

@ -12,40 +12,50 @@ body {
} }
body.dark-mode { body.dark-mode {
filter: invert(100%);
.image-container img {
filter: invert(100%);
}
.clapper {
filter: invert(100%);
}
.bg { .bg {
opacity: 0 !important; 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) { section:nth-child(even), footer:nth-child(even) {
background: #eee !important; background: #111 !important;
color: white;
} }
section:nth-child(odd), footer:nth-child(odd) { section:nth-child(odd), footer:nth-child(odd) {
background: white !important; background: #000 !important;
color: white;
} }
.works-card .text-container { .works-card .text-container {
color: #333 !important; color: #ddd !important;
a { a {
color: inherit !important; color: inherit !important;
background: rgba(0,0,0,0.1) !important; background: rgba(255,255,255,0.1) !important;
box-shadow: none !important; box-shadow: none !important;
} }
} }
footer { footer {
color: #333 !important; color: #ddd !important;
} }
} }
@ -226,7 +236,7 @@ body.dark-mode {
height: 0.33rem; height: 0.33rem;
width: 0.33rem; width: 0.33rem;
transform: rotate(45deg); transform: rotate(45deg);
border: 1px solid rgba(black, 1); border: 1px solid;
border-bottom: 0; border-bottom: 0;
border-left: 0; border-left: 0;
line-height: 1.2rem; line-height: 1.2rem;

View file

@ -160,7 +160,10 @@ function Point() {
this.draw = function() { this.draw = function() {
if(p.progress >= 0) { if(p.progress >= 0) {
// opacity of of dot changes with progress // 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(); ctx.beginPath();
// radius calculation: maps progress from [0, 1] to [0, pi], // radius calculation: maps progress from [0, 1] to [0, pi],
// then takes sine of that to get an increase, then decrease // then takes sine of that to get an increase, then decrease