Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pixel Art Maker #89

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
22 changes: 22 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href='pixel.css'></link>
</head>
<body>
<div class="border">
<div class="container">

</div>
</div>
<input type="color" onchange= "currentColor = this.value" class="colorMe"></input>
<input type="submit" value="Reset Canvas" class="eraseMe"></input>
<input type="color" onchange="paintAll = this.value" class="paintAll"></input>
<h1>Pixel Art Maker</h1>
<script src="pixel.js"></script>
</body>
</html>
43 changes: 43 additions & 0 deletions pixel.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
body {
margin: 100px auto;
border: 10px solid silver;
margin-bottom: 10px;
height: 300px;
width: 500px;
border-radius: 15px;
border-bottom: 100px solid silver;


}

.container {
height: 300px ;
width: 498px;
display: flex ;
flex-wrap: wrap;
background-color: silver;
padding-bottom: 8px;
padding-left: 3px;
padding-top: 3px;
}
.pixels {
background-color: white;
border: 1px solid black;
height: 10.2px;
width: 10.1px;
}



.paintAll {
margin-left: 150px;
}

.eraseMe {
margin-left: 130px
}

.colorMe {
margin-left: 7px
}

43 changes: 43 additions & 0 deletions pixel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

let cont = document.querySelector('.container')
let currentColor = document.querySelector('.colorMe').value
let eraseMe = document.querySelector('.eraseMe')
let paintAll = document.querySelector('.paintAll')



function grid(size) {
for(let i = 0; i < size * size; i++) {
let pixel = document.createElement('div')
pixel.classList.add('pixels')
pixel.addEventListener('click', () => {
pixel.style.backgroundColor = currentColor
})


pixel.addEventListener('mousedown', () => {
pixel.style.backgroundColor = undefined
})


cont.appendChild(pixel)
eraseMe.addEventListener('click' ,() => {
pixel.style.backgroundColor = "white"
})

paintAll.addEventListener('click', () => {
pixel.style.backgroundColor = paintAll
})


}
}
grid(32.01)

let saveFile = document.querySelector('.storage')
function save() {

}