Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 9 additions & 33 deletions custom/templates/DefaultRevamp/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -1062,45 +1062,21 @@ select {
display: inline-block;
}

.darkmode-toggle {
opacity: 0;
position: absolute;
}

.darkmode-toggle:checked+.darkmode-toggle-label .darkmode-ball {
transform: translateX(24px);
}

.darkmode-toggle-label {
background-color: #111;
display: flex;
align-items: center;
justify-content: space-between;
border-radius: 50px;
position: relative;
padding: 5px;
height: 26px;
width: 50px;
cursor: pointer;
}

.darkmode-ball {
background-color: #fff;
border-radius: 50%;
position: absolute;
top: 2px;
left: 2px;
height: 22px;
width: 22px;
transition: transform 0.2s linear;
#toggle-dark-mode {
width: 33px;
height: 33px;
}

.fa-moon {
#toggle-dark-mode[data-mode="dark"]::after {
content: "\f186";
color: #f1c400;
font-family: "Font Awesome 5 Free";
}

.fa-sun {
#toggle-dark-mode[data-mode="light"]::after {
content: "\f185";
color: #f39c00;
font-family: "Font Awesome 5 Free";
}

/*
Expand Down
22 changes: 6 additions & 16 deletions custom/templates/DefaultRevamp/footer.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,6 @@
{if $PAGE_LOAD_TIME}
<span class="item" id="page_load"></span>
{/if}
<span class="item" id="darkmode">
<input type="checkbox" class="darkmode-toggle" id="darkmode-toggle" onclick="toggleDarkLightMode()">
<label for="darkmode-toggle" class="darkmode-toggle-label">
<i class="fas fa-moon"></i>
<i class="fas fa-sun"></i>
<div class="darkmode-ball"></div>
</label>

<script type="text/javascript">
if (document.body.classList.contains('dark')) {
document.getElementById("darkmode-toggle").checked = true;
} else {
document.getElementById("darkmode-toggle").checked = false;
}
</script>
</span>
{if isset($AUTO_LANGUAGE)}
<a class="item" href="javascript:" onclick="toggleAutoLanguage()" id="auto-language"></a>
{/if}
Expand Down Expand Up @@ -109,6 +93,12 @@
return false;
}

if (document.body.classList.contains('dark')) {
document.getElementById("toggle-dark-mode").setAttribute("data-mode", "dark");
} else {
document.getElementById("toggle-dark-mode").setAttribute("data-mode", "light");
}

{if isset($AUTO_LANGUAGE)}
const autoLanguage = document.getElementById('auto-language');
const autoLanguageValue = $.cookie('auto_language') ?? 'true';
Expand Down
1 change: 1 addition & 0 deletions custom/templates/DefaultRevamp/navbar.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
{/if}
{/if}
{/foreach}
<a class="ui small default icon button" id="toggle-dark-mode" data-mode="dark" onclick="toggleDarkLightMode()"></a>
</div>
</div>
</div>
Expand Down