Skip to content

Commit 3299525

Browse files
committed
fix some stuff with the theme toggle function
1 parent ff5a6e4 commit 3299525

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/css/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,6 @@ button {
280280
--color-dark: #fff;
281281
--additional-text: #ddd;
282282
--square-bg: rgb(32, 99, 255);
283-
--count-color: #000;
283+
--count-color: #fff;
284284
--squareRoot-bg: rgb(7, 69, 184);
285285
}

src/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const value = document.getElementById("count");
77
const buttons = document.querySelectorAll(".btn");
88
const square = document.getElementById("square");
99
const squareRoot = document.getElementById("squareRoot");
10+
const container = document.querySelector(".container");
1011

1112
buttons.forEach(function (item) {
1213
item.addEventListener("click", function (e) {
@@ -34,7 +35,11 @@ buttons.forEach(function (item) {
3435
squareRoot.style.display = "block";
3536
document.getElementById("error").style.display = "none";
3637
} else {
37-
value.style.color = "currentColor";
38+
if (container.classList.contains("body-dark")) {
39+
value.style.color = "white";
40+
} else {
41+
value.style.color = "currentColor";
42+
}
3843
document.getElementById("error").style.display = "none";
3944
}
4045

0 commit comments

Comments
 (0)