Add dark mode

This commit is contained in:
stef-devs 2022-04-12 16:48:44 +02:00
parent 75376355e3
commit 2f8732c4b6
5 changed files with 162 additions and 32 deletions

View File

@ -2,7 +2,7 @@
<head>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
<link rel="stylesheet" href="https://1elci.it/style.css" type="text/css" media="all" />
<link rel="stylesheet" href="https:/1elci.it/style.css" type="text/css" media="all" />
<link rel="apple-touch-icon" sizes="57x57" href="https://1elci.it/Favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://1elci.it/Favicon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://1elci.it/Favicon/apple-icon-72x72.png">
@ -30,6 +30,10 @@
<br>
<br>
<center><iframe src="https://calendar.google.com/calendar/embed?height=600&amp;wkst=2&amp;bgcolor=%23ffffff&amp;ctz=Europe%2FRome&amp;showTitle=0&amp;showNav=1&amp;showDate=1&amp;showPrint=0&amp;showTabs=0&amp;showCalendars=1&amp;showTz=0&amp;src=NnZ2ZWljN2ZuaGRkdjNyY2JnNTIycTJzc3NAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ&amp;color=%23F09300" style="border-width:0" width="1000" height="600" frameborder="0" scrolling="no"></iframe></center>
<div class="container">
<input class="container_toggle" type="checkbox" id="switch" name="mode">
<label for="switch">Toggle</label>
</div>
<script src="https://1elci.it/function.js"></script>
</body>
</head>

18
function.js Normal file
View File

@ -0,0 +1,18 @@
var checkbox = document.querySelector('input[name=mode]');
checkbox.addEventListener('change', function() {
if(this.checked) {
trans()
document.documentElement.setAttribute('data-theme', 'dartheme')
} else {
trans()
document.documentElement.setAttribute('data-theme', 'lighttheme')
}
})
let trans = () => {
document.documentElement.classList.add('transition');
window.setTimeout(() => {
document.documentElement.classList.remove('transition');
}, 1000)
}

View File

@ -23,7 +23,6 @@
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
</head>
<body>
<header>
@ -45,5 +44,10 @@
<br>
<br>
<br>
<div class="container">
<input class="container_toggle" type="checkbox" id="switch" name="mode">
<label for="switch">Toggle</label>
</div>
<script src="https://1elci.it/function.js"></script>
</body>

View File

@ -32,6 +32,12 @@
<br>
<br>
<center><img class="u-image u-image-default u-image-1" src="https://1elci.it/orario/orario.png" alt="" data-image-width="948" data-image-height="610"></center>
<div class="container">
<input class="container_toggle" type="checkbox" id="switch" name="mode">
<label for="switch">Toggle</label>
</div>
<script src="https://1elci.it/function.js"></script>
</body>
</html>
</body>

154
style.css
View File

@ -1,32 +1,130 @@
a {
text-decoration: none;
outline: none;
display: inline-block;
width: 250px;
height: 50px;
line-height: 45px;
border-radius: 45px;
margin: 10px 20px;
font-family: 'Montserrat', sans-serif;
font-size: 11px;
text-transform: uppercase;
text-align: center;
letter-spacing: 3px;
font-weight: 600;
color: #524f4e;
background: white;
box-shadow: 0 8px 15px rgba(0,0,0,.1);
transition: .3s;
}
a:hover {
background: #2EE59D;
box-shadow: 0 15px 20px rgba(46,229,157,.4);
color: white;
transform: translateY(-7px);
}
text-decoration: none;
outline: none;
display: inline-block;
width: 250px;
height: 50px;
line-height: 45px;
border-radius: 45px;
margin: 10px 20px;
font-family: 'Montserrat', sans-serif;
font-size: 11px;
text-transform: uppercase;
text-align: center;
letter-spacing: 3px;
font-weight: 600;
color: #524f4e;
background: white;
box-shadow: 0 8px 15px rgba(0,0,0,.1);
transition: .3s;
}
a:hover {
background: #2EE59D;
box-shadow: 0 15px 20px rgba(46,229,157,.4);
color: white;
transform: translateY(-7px);
}
a:logo {
margin-top: 43px;
float: left;
width: 358px;
margin-top: 43px;
float: left;
width: 358px;
}
@import url("https://fonts.googleapis.com/css?family=Fredoka+One&display=swap");
html {
background: var(--backg);
--btn: #2ab1ce;
--backg: #fff;
--colorx: #232323;
width: 100%;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
html[data-theme='dartheme'] {
background: var(--backg);
--btn: #ea4b3c;
--backg: #232323;
--colorx: #fff;
}
h1 {
font-family: 'Fredoka One', cursive;
font-weight: 300;
color: var(--colorx);
}
h2 {
font-family: 'Fredoka One', cursive;
font-weight: 100;
color: var(--colorx);
}
input[type=checkbox] {
visibility: hidden;
height: 0;
width: 0;
}
label {
margin: 0 auto;
display: flex;
justify-content: center;
align-items: center;
border-radius: 100px;
position: relative;
cursor: pointer;
text-indent: -9999px;
width: 60px;
height: 30px;
background: var(--btn);
position : absolute;
line-height: 12px;
width: 60px;
font-size: 50pt;
font-family: tahoma;
margin-top: 5px;
margin-right: 6px;
position:absolute;
top: 15px;
right: 15px;
}
label:after {
border-radius: 50%;
position: absolute;
content: '';
background: #fff;
width: 20px;
height: 20px;
top: 5px;
left: 4px;
transition: ease-in-out 200ms;
}
input:checked + label {
background: #ea4b3c;
}
input:checked + label:after {
left: calc(100% - 5px);
transform: translateX(-100%);
}
html.transition,
html.transition *,
html.transition *:before,
html.transition *:after {
transition: ease-in-out 200ms !important;
transition-delay: 0 !important;
}
#nomeid{
position : absolute;
left : 20px;
right : 20px;
}