Skip to content
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
Binary file added src/blocks/TanasovAlexandru/Bgen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions src/blocks/TanasovAlexandru/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!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>Gradient Background</title>
<link rel="stylesheet" href="style.css">
</head>
<body id="gradient">
<h1>Background Generator</h1>
<input class="color1" type="color" name="color1" value="#00ff00">
<input class="color2" type="color" name="color2" value="#ffffff">
<button id="but" type="text">Try random colors</button>
<h2>This is the background</h2>
<h3></h3>

<script type="text/javascript" src="script.js"></script>
</body>
</html>
5 changes: 5 additions & 0 deletions src/blocks/TanasovAlexandru/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"block_name": "Background Generator",
"author_name": "TanasovAlexandru",
"author_github_url": "https://github.com/AlexT0307/"
}
45 changes: 45 additions & 0 deletions src/blocks/TanasovAlexandru/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
var css = document.querySelector("h3");
var color1 = document.querySelector(".color1");
var color2 = document.querySelector(".color2");
var body = document.getElementById("gradient");
var button = document.getElementById("but");

function setBg(){
var randomcolor1 = randomColor = Math.floor(Math.random()*16777215).toString(16);
var randomcolor2 = randomColor = Math.floor(Math.random()*16777215).toString(16);
color1.value = "#" + randomcolor1;
color2.value = "#" + randomcolor2;
setGradient();
}

button.addEventListener ("click", setBg)

color1.value ="#ff0000";
color2.value = "#ffff00";

function display(){
css.innerHTML = "linear-gradient(to right, rgb(255, 0, 0), rgb(255, 255, 0));";
}
display()
function setGradient() {
body.style.background =
"linear-gradient(to right, "
+ color1.value
+ ", "
+ color2.value
+ ")";
css.textContent = body.style.background + ";";
}

// // body.style.background = "red";
// color1.addEventListener("input", function() {
// setGradient();

// })

// color2.addEventListener("input", function(){
// setGradient();
// })

color1.addEventListener("input", setGradient);
color2.addEventListener("input", setGradient);
34 changes: 34 additions & 0 deletions src/blocks/TanasovAlexandru/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
body{
font: 'Raleway', sans-serif;
color: rgba(0, 0, 0, 0.5);
text-align: center;
text-transform: uppercase;
letter-spacing: .5em;
top: 15%;
background: linear-gradient(to right, #ff0000, #ffff00);
}
/* .color1 {
color: red;
} */
#but {
background-color: yellow;
color: black;
text-transform: uppercase;
font-family: 'Times New Roman', Times, serif;
}
h1 {
font: 600 3.5em 'Raleway', sans-serif;
color: rgba(0, 0, 0, 0.5);
text-transform: uppercase;
text-align: center;
letter-spacing: .5em;
width: 100%;
}

h3 {
font: 900 1em 'Raleway, sans-serif';
color: rgba(0, 0, 0, 0.5);
text-align: center;
text-transform: none;
letter-spacing: 0.01em;
}