Skip to content

Commit

Permalink
Merge pull request #900 from Arcturus22/Project-Contri
Browse files Browse the repository at this point in the history
Added the Random-Color-Generator
  • Loading branch information
PBJI authored Oct 15, 2023
2 parents 78d1c3c + 964ba92 commit 5a04dba
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 0 deletions.
Binary file added RandomColorGenerator/Arcturus22/Image1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added RandomColorGenerator/Arcturus22/Image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions RandomColorGenerator/Arcturus22/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!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>Random Color Generator</title>
<link rel="stylesheet" href="style.css">
</head>

<body>

<div id="Heading">
<strong> <p id="Text">Random color generator </p> </strong>
</div>
<div class="container">
<div id="Color">
<p id="color-text">White</p>
</div>

<div class="button">
<button class="btn" id="b1">Click to change color.</button>
</div>

<div class="button">
<button id="b2" class="btn">Reset.</button>
</div>
</div>
<script src="index.js"></script>
</body>

</html>
25 changes: 25 additions & 0 deletions RandomColorGenerator/Arcturus22/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@


document.getElementById("b1").onclick = function () {
let r, g, b, appleColor;
r = Math.round(Math.random() * 256);
g = Math.round(Math.random() * 256);
b = Math.round(Math.random() * 256);
appleColor = 'RGB(' + r + ',' + g + ',' + b + ')';
document.getElementById("Color").style.backgroundColor
= appleColor;
document.getElementById("color-text").innerHTML=
appleColor;


}
document.getElementById("b2").onclick =
function(){

let color="white";
document.getElementById("Color").style.backgroundColor
=color;
document.getElementById("color-text").innerHTML=
"White";
}

7 changes: 7 additions & 0 deletions RandomColorGenerator/Arcturus22/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Random-Color-Generator
This is a JS project that generates random colour with its RGB value shown on the screen.
A reset feature has also been added to reset the colour to original color.

## Tutorial Links to follow:-
### Git and Github
https://youtu.be/apGV9Kg7ics
79 changes: 79 additions & 0 deletions RandomColorGenerator/Arcturus22/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
body{
background: rgb(131,58,180);
background: linear-gradient(90deg, rgba(131,58,180,1) 0%, rgba(253,29,29,1) 50%, rgba(252,176,69,1) 100%);
}
#Heading{
text-align: center;
font-size: 60px;
color: white;
font-family: Verdana, Geneva, Tahoma, sans-serif;
}
.container{
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin-top: 0px;
}
#Color{
background-color: white;
height: 300px;
width: 300px;
margin: 10px auto;
padding-top: 20px;
border-radius: 1em;
box-shadow: 10px 10px 8px #181717;
}
#color-text{
border-radius: 1em;
text-align: center;
font-size: 23px;
width: 190px;
background-color: white;
padding: 15px;
border: 1px solid black;
display: block;
margin: 30px auto;
}
.btn{
margin-top: 20px ;
padding: 10px;
font-size: 22px;
background-color: rgb(230, 170, 215);
border-radius: 9px;
cursor: pointer;
transition: 0.3s;
box-shadow: 10px 10px 8px #181717;

}
#b2{
background-color: bisque;
}
.button{
text-align: center;

}

.btn:hover{
background-color: yellow;
font-size: 25px;
}

@media (max-height:638px ) {

#Heading{
font-size: 30px;
}
#Color{
height: 150px;
width: 150px;
margin: 5px auto;
padding-top: 10px;
border-radius: 1em;
}
#color-text{
width: 95px;
padding: 7.5px;
margin: 15px auto;
}
}

0 comments on commit 5a04dba

Please sign in to comment.