-
Notifications
You must be signed in to change notification settings - Fork 0
/
theme.js
80 lines (63 loc) · 2.21 KB
/
theme.js
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
const themeDark = [/*.some texts*/'#fff',
/*header*/'#000',
/*body*/'#484d50',
/*cards*/'#235a60',
/*cardTotal*/'#40e0d0',
/*toogle*/'#0037a4',
/*footer*/'#fff']
const themeDefault = [/*.some texts*/'#000',
/*header*/'#097392',
/*body*/'#f0f2f5',
/*cards*/'#fff',
/*cardTotal*/' #3dd705',
/*toogle*/'#000',
/*footer*/'#363f5f']
let style = 'light'
let head = document.querySelector('header')
let body = document.body
let cards = document.querySelectorAll('.cards')
let cardTotal = document.querySelector('.cards.total')
let foot = document.querySelector('.rodape-link')
let tableTitle = document.querySelectorAll('.title')
let tableDate = document.querySelectorAll('.date')
let tableDescription = document.querySelectorAll('.description')
let sun = document.querySelector('.sun')
let moon = document.querySelector('.moon')
let rocket = document.querySelector('.rocket')
function selectStyle() {
let theme
switch (style) {
case 'light':
theme = themeDark;
style = 'dark'
sun.style.opacity = 0
moon.style.opacity = 1
break;
case 'dark':
theme = themeDefault
style = 'light'
sun.style.opacity = 1
moon.style.opacity = 0
break;
}
changeColor(theme)
}
function changeColor(pallette) {
head.style.background = pallette[1]
body.style.background = pallette[2]
cardTotal.style.background = pallette[4]
for(i=0; i<(cards.length-1); i++) {
cards.item(i).style.background = pallette[3]
cards.item(i).style.color = pallette[0]
}
for(let date of tableDate) {
date.style.color = pallette[6]
}
for(let description of tableDescription) {
description.style.color = pallette[6]
}
for(let title of tableTitle) {
title.style.color = pallette[6]
}
foot.style.color = pallette[6]
}