You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
692 B
JavaScript
28 lines
692 B
JavaScript
let palettes = {
|
|
purple: {
|
|
color: "#7D50FF",
|
|
lightColor: "#CEC6FF",
|
|
},
|
|
|
|
orange: {
|
|
color: "#FF5416",
|
|
lightColor: "#FFB58D",
|
|
},
|
|
};
|
|
|
|
window.addEventListener("load", () => {
|
|
let shade = Math.random() > 0.5 ? "purple" : "orange";
|
|
color = palettes[shade]["color"];
|
|
lightColor = palettes[shade]["lightColor"];
|
|
document.documentElement.style.setProperty("--color", color);
|
|
document.documentElement.style.setProperty("--light-color", lightColor);
|
|
|
|
var link = document.querySelector("link[rel~='icon']");
|
|
if (!link) {
|
|
link = document.createElement("link");
|
|
link.rel = "icon";
|
|
document.getElementsByTagName("head")[0].appendChild(link);
|
|
}
|
|
link.href = `favi-${shade}.ico`;
|
|
});
|