-
Notifications
You must be signed in to change notification settings - Fork 879
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #900 from Arcturus22/Project-Contri
Added the Random-Color-Generator
- Loading branch information
Showing
6 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |