Skip to content

Instantly share code, notes, and snippets.

View WuerfelDev's full-sized avatar
🚀

WuerfelDev WuerfelDev

🚀
View GitHub Profile
@WuerfelDev
WuerfelDev / SimpleWebpage.html
Last active April 11, 2018 15:54
One Image: as big as possible. Lightweight.
<!DOCTYPE HTML>
<html>
<head>
<title>Title</title>
<style>
body {
margin: 0px;
height: 100%;
width: 100%;
@WuerfelDev
WuerfelDev / themecolor.html
Created April 6, 2018 14:44
hsl theme-color animartion
<!doctype html>
<html>
<head>
<meta name="theme-color" content="#FF0000">
<script>
// https://stackoverflow.com/a/44134328/4346956
// https://gordonlesti.com/change-theme-color-via-javascript/
function hslToHex(h, s, l) {
@WuerfelDev
WuerfelDev / hoverbyclass.js
Created March 11, 2018 14:42
change background color for all elements with the same class by hovering one
function hoverByClass(classname,colorover,colorout="transparent"){
var elms=document.getElementsByClassName(classname);
for(var i=0;i<elms.length;i++){
elms[i].onmouseover = function(){
for(var k=0;k<elms.length;k++){
elms[k].style.backgroundColor=colorover;
}
};
elms[i].onmouseout = function(){
for(var k=0;k<elms.length;k++){
@WuerfelDev
WuerfelDev / randomcolors.js
Last active May 8, 2019 18:39
Nice random color generator
var colorCache = Array();
function randomColor() {
const r = () => 200 + Math.floor(56 * Math.random()); //Strong color
var rl = Array();
do {
rl[0] = r();
rl[1] = r() - 50 - Math.floor(206 * Math.random()); // Clearer defined color
rl[2] = r() - 50 - Math.floor(50 * Math.random());
rl.sort(function() {
return 0.5 - Math.random();