-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolors.html
56 lines (53 loc) · 1.74 KB
/
colors.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
<!doctype html>
<html>
<body>
<div class="color-list" id="thecolorlist"></div>
<style>
.color-list {
display: flex;
flex-direction: row;
justify-items: flex-start;
color: black;
}
.color-item {
display: flex;
flex-direction: column;
padding: 5px;
align-items: center;
}
.color-box {
margin-bottom: 5px;
border-radius: 5px;
border: 1px solid black;
width: 80px;
height: 80px;
}
</style>
<script>
var colors = {
'blue': '#3b6ca7',
'gray_dark': '#303030',
'gray_light': '#b3b3b3',
'green': '#417f55',
'green_light': '#7cce97',
'orange': '#f14902',
'pink': '#a570dd',
'sky_blue': '#88befe',
'violet': '#ad43e2',
'yellow': '#f5b028',
}
Object.entries(colors).forEach(([color, hex]) => {
var container = document.createElement('div')
var div = document.createElement('div')
var label = document.createElement('span')
container.classList.add('color-item')
div.classList.add('color-box')
div.style.backgroundColor = hex
label.innerHTML = color
container.appendChild(div)
container.appendChild(label)
document.getElementById("thecolorlist").appendChild(container)
})
</script>
</body>
</html>