Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Background Color Changer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
### Background Color Changer

### Tech stack
- Html
- css
- JavaScript
11 changes: 11 additions & 0 deletions Background Color Changer/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Color Changer</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<button>CHANGE</button>
<script type="text/javascript" src="script.js"></script>
</body>
</html>
6 changes: 6 additions & 0 deletions Background Color Changer/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var color= ["#222f3e","#f368e0","#ee5353","#6c55cc","#24ffff","#ff2626","#ffffff","#000000","#7878ff","#cdcdcd","#454545","#909090","#cccddd","#0abde3","#10ac84","#5f27cd"];
var i=0;
document.querySelector("button").addEventListener("click",function(){
i=1<color.length ? ++i : 0;
document.querySelector("body").style.background=color[i]
})
18 changes: 18 additions & 0 deletions Background Color Changer/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
body{
margin: 0;
padding: 0;
background-color: #222f3e;
}
button{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
padding: 10px;
background-color: #fff;
border:none;
outline: none;
font-size: 16px;
text-transform: uppercase;
cursor: pointer;
}