Skip to content

Instantly share code, notes, and snippets.

@anLpk
Created December 7, 2020 03:50
Show Gist options
  • Select an option

  • Save anLpk/c13a719e90c14e299d0475f327566151 to your computer and use it in GitHub Desktop.

Select an option

Save anLpk/c13a719e90c14e299d0475f327566151 to your computer and use it in GitHub Desktop.
"use strict";
const toggleTextColor = document.querySelector(".darktext");
const switchBtn = document.querySelector(".switch");
const bodyColorChanges = document.querySelector("body");
const cardBgColorChanges = document.querySelector(".dark");
const changeTextColor = function () {
toggleTextColor.classList.remove("darktext");
};
const changeCardColor = function () {
cardBgColorChanges.style.backgroundColor = "hsl(227, 47%, 96%)";
};
switchBtn.addEventListener("click", changeTextColor);
switchBtn.addEventListener("click", changeCardColor);
switchBtn.addEventListener("click", function () {
bodyColorChanges.style.backgroundColor = "white";
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment