GitbookIO / javascript

GitBook teaching programming basics with Javascript
https://gitbook.gitbook.io/learn-javascript/
Apache License 2.0
3.57k stars 1.01k forks source link

[feature-Request] Dark mode make website more attractive #179

Open mohitmk007 opened 1 year ago

mohitmk007 commented 1 year ago

add dark mode functionality

Pratik-09pp commented 1 year ago

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

Tsiangana commented 10 months ago

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**

That1ProgrammerJS commented 3 weeks ago

Is There A Website?