Random Gradients - JS
How do I make an random gradients - js?
What is a random gradients - js? How do you make a random gradients - js? This script and codes were developed by Aaron Levine on 30 January 2023, Monday.
Random Gradients - JS - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Random Gradients - JS</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <script src="js/index.js"></script>
</body>
</html>
Random Gradients - JS - Script Codes CSS Codes
html, body { width:100%; height:100%; margin:0; padding:0;
}
div { height: 10px;
}
Random Gradients - JS - Script Codes JS Codes
function hslToHex(h, s, l){ var r, g, b; if(s == 0){ r = g = b = l; }else{ function hue2rgb(p, q, t){ if(t < 0) t += 1; if(t > 1) t -= 1; if(t < 1/6) return p + (q - p) * 6 * t; if(t < 1/2) return q; if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; return p; } var q = l < 0.5 ? l * (1 + s) : l + s - l * s; var p = 2 * l - q; r = hue2rgb(p, q, h + 1/3); g = hue2rgb(p, q, h); b = hue2rgb(p, q, h - 1/3); } r = (r * 255).toFixed(0); g = (g * 255).toFixed(0); b = (b * 255).toFixed(0); var hR = Number(r).toString(16), hG = Number(g).toString(16), hB = Number(b).toString(16); hR = hR.length == 1 ? hR + '0' : hR.length > 2 ? hR[0] + hR[1] : hR; hG = hG.length == 1 ? hG + '0' : hG.length > 2 ? hG[0] + hG[1] : hG; hB = hB.length == 1 ? hB + '0' : hB.length > 2 ? hB[0] + hB[1] : hB; return '#'+hR+hG+hB;
}
for(var i = 1; i <= 48; i++){ var hue = Math.random(); for(var j = 1; j <= 5; j++){ var color = hslToHex(hue, 0.5, j/8 + 0.15), div = document.createElement('DIV'); div.style.background = color; document.body.appendChild(div); }
}
Developer | Aaron Levine |
Username | Aldlevine |
Uploaded | January 30, 2023 |
Rating | 3 |
Size | 2,026 Kb |
Views | 4,048 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Nav-Bar and Tab-Bar Layout | 3,936 Kb |
CSS Spinning Wireframe Sphere | 4,612 Kb |
Pure CSS Rating Scale | 2,706 Kb |
Canvas Falloff Test | 2,989 Kb |
CRT TV Page Load Animation | 2,498 Kb |
A Pen by Aaron Levine | 4,042 Kb |
IOS-7 style slide-toggle | 4,131 Kb |
Colored Rain | 3,190 Kb |
Progress | 2,659 Kb |
Price is Right Wheel - Better Inertia | 5,730 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Css or Czz.. | Judag | 4,111 Kb |
Amazing CSS Menu with Notification Badges | Faizanasad | 2,549 Kb |
Shopping cart | Andiio | 6,581 Kb |
Twinkling Stars | Ripley6811 | 2,750 Kb |
A Pen by Kenny Mark | Kennymark | 5,574 Kb |
Scroll to top button | DominicFrancois | 3,743 Kb |
Save for later... | Victorfreire | 1,359 Kb |
Fluid Responsive Typography | Jonmilner | 4,205 Kb |
Contact | GanNichiHa | 2,514 Kb |
A Pen by lizz | Lizz | 10,068 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!