Skip to content

Commit

Permalink
MORE NEONNN
Browse files Browse the repository at this point in the history
  • Loading branch information
yazidears committed May 22, 2024
1 parent 4a3836f commit bfa2703
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
19 changes: 12 additions & 7 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
document.getElementById('generateBtn').addEventListener('click', generateGradient);

function generateGradient() {
const colors = generateRandomColors(4);
const colors = generatePresetColors();
const gradient = `linear-gradient(90deg, ${colors.join(', ')})`;
const previewElement = document.getElementById('gradientPreview');
previewElement.style.background = gradient;
Expand All @@ -11,10 +11,15 @@ function generateGradient() {
document.getElementById('cssOutput').value = `background: ${gradient};\nbackground-size: 400% 400%;\nanimation: gradientAnimation 15s ease infinite;`;
}

function generateRandomColors(num) {
const colors = [];
for (let i = 0; i < num; i++) {
colors.push(`#${Math.floor(Math.random() * 16777215).toString(16).padStart(6, '0')}`);
}
return colors;
function generatePresetColors() {
const presetColors = [
['#fcb045', '#fd1d1d', '#833ab4'],
['#00c6ff', '#0072ff'],
['#f77062', '#fe5196'],
['#ff5f6d', '#ffc371'],
['#43e97b', '#38f9d7'],
['#30cfd0', '#330867']
];
const randomIndex = Math.floor(Math.random() * presetColors.length);
return presetColors[randomIndex];
}
22 changes: 11 additions & 11 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ body, html {

h1 {
font-size: 3rem;
color: #00ffcc;
text-shadow: 0 0 10px #00ffcc, 0 0 20px #00ffcc, 0 0 30px #00ffcc, 0 0 40px #00ffcc;
color: #ff0055;
text-shadow: 0 0 10px #ff0055, 0 0 20px #ff0055, 0 0 30px #ff0055, 0 0 40px #ff0055;
}

#generateBtn {
Expand All @@ -27,14 +27,14 @@ h1 {
font-size: 18px;
cursor: pointer;
background-color: #333;
border: 2px solid #00ffcc;
color: #00ffcc;
border: 2px solid #ff0055;
color: #ff0055;
transition: background-color 0.3s, color 0.3s, border 0.3s;
text-shadow: 0 0 10px #00ffcc;
text-shadow: 0 0 10px #ff0055;
}

#generateBtn:hover {
background-color: #00ffcc;
background-color: #ff0055;
color: #0d0d0d;
border: 2px solid #0d0d0d;
}
Expand All @@ -45,20 +45,20 @@ h1 {
margin: 20px 0;
background-size: 400% 400%;
animation: gradientAnimation 15s ease infinite;
border: 2px solid #00ffcc;
box-shadow: 0 0 20px #00ffcc;
border: 2px solid #ff0055;
box-shadow: 0 0 20px #ff0055;
}

textarea {
width: 100%;
height: 100px;
background: #222;
color: #00ffcc;
border: 2px solid #00ffcc;
color: #ff0055;
border: 2px solid #ff0055;
padding: 10px;
font-size: 16px;
resize: none;
box-shadow: 0 0 10px #00ffcc;
box-shadow: 0 0 10px #ff0055;
}

@keyframes gradientAnimation {
Expand Down

0 comments on commit bfa2703

Please sign in to comment.