File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
trybe-projetos/pixels-art Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -26,11 +26,12 @@ <h1 id="title" class="main-font bg-title">PIXEL ART - SUA ARTE EM 8 BIT</h1>
2626 < input id ="board-size " type ="number " min ="1 "
2727 oninput ="validity.valid ? this.save = value : value = this.save; " placeholder ="Min: 5 Max: 50 "
2828 class ="main-font ">
29- < button id ="generate-board " class ="main-font "> VQV</ button >
29+ < button id ="generate-board " class ="main-font "> VQV! </ button >
3030 </ div >
3131
3232 < div id ="color " class ="main-font horizontal "> Escolha uma cor:
3333 < input id ="palette-color " class ="horizontal main-font " type ="color ">
34+ < button id ="select-color " class ="main-font "> VQV!</ button >
3435 < button id ="clear-board " class ="main-font "> Limpar</ button >
3536 </ div >
3637 </ div >
Original file line number Diff line number Diff line change 22const imputBoardSize = document . getElementById ( 'board-size' ) ;
33let pixelBoard = document . getElementById ( 'pixel-board' ) ;
44const buttonGenerateBoard = document . getElementById ( 'generate-board' ) ;
5-
5+ let paletteColor = document . getElementById ( 'palette-color' ) ;
6+ let colorStore = 'background-color: rgb(0, 0, 0)' ;
7+ const buttonSelectColor = document . getElementById ( 'select-color' ) ;
68
79//MUNDA QUANTIDADE DE PIXEL PARA PINTAR.
810function sizeBoard ( ) {
@@ -36,3 +38,20 @@ buttonGenerateBoard.addEventListener('click', function () {
3638 sizeBoard ( ) ;
3739 }
3840} )
41+
42+ //SELECIONA COR
43+ buttonSelectColor . addEventListener ( 'click' , function ( event ) {
44+ let aux = paletteColor . value
45+ colorStore = aux ;
46+ console . log ( aux ) ;
47+ console . log ( colorStore ) ;
48+ } )
49+
50+ //COLORE PIXEL
51+ function colorize2 ( paint ) {
52+ paint . setAttribute ( 'style' , 'background-color: ' + colorStore , ) ;
53+ }
54+
55+ pixelBoard . addEventListener ( 'click' , function ( event ) {
56+ colorize2 ( event . target ) ;
57+ } )
You can’t perform that action at this time.
0 commit comments