GitbookIO/javascript

[feature-Request] Dark mode make website more attractive

Opened this issue · 2 comments

add dark mode functionality

@mohitmk007 I would like to work on this issue? Can you assign it to me?

The code:

let button1 = document.getElementbyId("button1");
let button2 = document.getElementbyId("button2");

button1.addEventListener('click', ()=>{
body.style.background= "#000";
button1.style.display = "none";
button2.style.display = "inline";
})
button2.addEventListener('click', ()=>{
body.style.background= "#fff";
button2.style.display = "none";
button1.style.display = "inline";
})

**This is the simplest way to create dark mode, it's so simple that any beginner can do it.

creates two buttons in the same place, one will start with the value none, while the other will have the value iniline, when one is activated it changes the color of the body and hides itself while the other appears and vice versa.

There are several ways to do dak mode with js and other more professional ways, but this is the simplest and fastest way to do it**