forked from Shinmera/lem-icon
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
110 lines (108 loc) · 3.35 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html>
<html>
<head>
<title>Lem Logo</title>
<style type="text/css">
body{
font-family: sans-serif;
font-size: 28pt;
text-align: center;
margin: 80px 0 0 0;
overflow-y: scroll;
}
.settings{
background: white;
position: fixed;
top: 0;
left: 0;
right: 0;
}
.settings div{
display: inline-block;
margin: 10px;
}
main{
font-size: 0;
max-width: 1000px;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.wrap{
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
padding: 30px;
transition: background-color 0.5s ease;
width: 300px;
margin: 0;
}
.wrap p{
margin: 0;
font-size: 28pt;
}
object{
width: 64px;
height: 64px;
}
</style>
</head>
<body>
<div class="settings">
<div><label>Background:</label> <input type="color" value="#FFFFFF" id="background" /></div>
<div><label>Foreground:</label> <input type="color" value="#000000" id="foreground" /></div>
<div><label>Size:</label> <input type="range" min="8" max="256" value="64" id="size" /></div>
</div>
<main>
<div class="wrap">
<object type="image/svg+xml" data="icon-blue.svg"></object>
<p>Blue</p>
</div>
<div class="wrap">
<object type="image/svg+xml" data="icon-blue-brighter.svg"></object>
<p>Blue Brighter</p>
</div>
<div class="wrap">
<object type="image/svg+xml" data="icon-blue-darker.svg"></object>
<p>Blue Darker</p>
</div>
<div class="wrap">
<object type="image/svg+xml" data="icon-blue-light.svg"></object>
<p>Blue Light</p>
</div>
</main>
<script type="text/javascript">
var init = function(){
var background = document.getElementById("background");
var foreground = document.getElementById("foreground");
var size = document.getElementById("size");
var main = document.getElementsByTagName("main")[0];
var imgs = document.getElementsByTagName("object");
var updateIcons = function(){
var bg = background.value;
var fg = foreground.value;
var sz = size.value;
main.style.background = bg;
for(var i=0; i<imgs.length; i++){
var img = imgs[i];
img.style.width = sz+"px";
img.style.height = sz+"px";
if(img.classList.contains("colorable")){
var paths = img.contentDocument.querySelectorAll("path,circle,rect");
for(var j=0; j<paths.length; j++){
paths[j].style.fill = fg;
}
}
}
}
background.addEventListener('input', updateIcons);
foreground.addEventListener('input', updateIcons);
size.addEventListener('input', updateIcons);
updateIcons();
};
document.addEventListener("DOMContentLoaded", init, false);
</script>
</body>
</html>