added Halloween theme
This commit is contained in:
parent
3f045c54e4
commit
6e3e5e7fb5
4 changed files with 70 additions and 1 deletions
|
@ -10,9 +10,16 @@
|
||||||
--dGray6:#1C1C1E;
|
--dGray6:#1C1C1E;
|
||||||
--dBlue:#0A84FF;
|
--dBlue:#0A84FF;
|
||||||
}
|
}
|
||||||
|
html {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
padding-top: 70px;
|
padding-top: 70px;
|
||||||
|
background-size: cover;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.padding-top {
|
.padding-top {
|
||||||
|
@ -97,6 +104,10 @@ a.divLink {
|
||||||
margin: 0 1rem;
|
margin: 0 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.darkmode {
|
.darkmode {
|
||||||
background-color: var(--dGray5);
|
background-color: var(--dGray5);
|
||||||
color: var(--dGray1);
|
color: var(--dGray1);
|
||||||
|
|
BIN
app/static/images/Halloween.jpeg
Normal file
BIN
app/static/images/Halloween.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 993 KiB |
|
@ -1,7 +1,14 @@
|
||||||
{
|
{
|
||||||
var $darkmode = document.querySelector(".enter_darkmode");
|
var $darkmode = document.querySelector(".enter_darkmode");
|
||||||
|
var $customThemes = document.querySelector(".custom__themes");
|
||||||
const init = () => {
|
const init = () => {
|
||||||
$darkmode.addEventListener("click", toggleDarkmode);
|
$darkmode.addEventListener("click", toggleDarkmode);
|
||||||
|
if($customThemes){
|
||||||
|
$customThemes.addEventListener("click", toggleCustomThemes);
|
||||||
|
}
|
||||||
|
if(localStorage.getItem("customThemes") == 'true'){
|
||||||
|
setThemeHalloween();
|
||||||
|
}
|
||||||
enableDarkmode();
|
enableDarkmode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +18,7 @@
|
||||||
localStorage.setItem("darkmode", newState);
|
localStorage.setItem("darkmode", newState);
|
||||||
enableDarkmode();
|
enableDarkmode();
|
||||||
}
|
}
|
||||||
|
|
||||||
const enableDarkmode = () => {
|
const enableDarkmode = () => {
|
||||||
if (typeof(Storage) !== "undefined") {
|
if (typeof(Storage) !== "undefined") {
|
||||||
if(localStorage.getItem("darkmode") == 'true' && localStorage.getItem("darkmodeChanged") == 'true' || (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches && localStorage.getItem("darkmodeChanged") != 'true')){
|
if(localStorage.getItem("darkmode") == 'true' && localStorage.getItem("darkmodeChanged") == 'true' || (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches && localStorage.getItem("darkmodeChanged") != 'true')){
|
||||||
|
@ -24,5 +32,53 @@
|
||||||
console.log('You browser does not support local storage, no darkmode for you!' )
|
console.log('You browser does not support local storage, no darkmode for you!' )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const toggleCustomThemes = () => {
|
||||||
|
if(localStorage.getItem("customThemes") == 'true'){
|
||||||
|
localStorage.setItem("customThemes", 'false');
|
||||||
|
setThemeDarkMode();
|
||||||
|
}else{
|
||||||
|
localStorage.setItem("customThemes", 'true');
|
||||||
|
localStorage.setItem("darkmodeChanged", 'true');
|
||||||
|
localStorage.setItem("darkmode", 'true');
|
||||||
|
enableDarkmode();
|
||||||
|
setThemeHalloween();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const setTheme = theme =>{
|
||||||
|
switch(theme){
|
||||||
|
case "halloween":
|
||||||
|
setThemeHalloween();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const setThemeDarkMode = () => {
|
||||||
|
document.querySelector('.enter_darkmode').classList.remove("hidden");
|
||||||
|
let root = document.documentElement;
|
||||||
|
root.style.setProperty('--dGray6', "#1C1C1E"); //Dark color
|
||||||
|
root.style.setProperty('--dGray5', "#2C2C2E");
|
||||||
|
root.style.setProperty('--dGray4', "#3A3A3C");
|
||||||
|
root.style.setProperty('--dGray3', "#48484A");
|
||||||
|
root.style.setProperty('--dGray2', "#636366");
|
||||||
|
root.style.setProperty('--dGray1', "#8E8E93");
|
||||||
|
root.style.setProperty('--dGray0', "#B0B0B8"); //Light color
|
||||||
|
root.style.setProperty('--dBlue', "#0A84FF");
|
||||||
|
document.body.style.backgroundImage = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
const setThemeHalloween = () => {
|
||||||
|
document.querySelector('.enter_darkmode').classList.add("hidden");
|
||||||
|
let root = document.documentElement;
|
||||||
|
root.style.setProperty('--dGray6', "#260101"); //Dark color
|
||||||
|
root.style.setProperty('--dGray5', "#260101");
|
||||||
|
root.style.setProperty('--dGray4', "#8C3D0F");
|
||||||
|
root.style.setProperty('--dGray3', "#F27405");
|
||||||
|
root.style.setProperty('--dGray2', "#F25C05");
|
||||||
|
root.style.setProperty('--dGray1', "#F28705");
|
||||||
|
root.style.setProperty('--dGray0', "#FFEB65"); //Light color
|
||||||
|
root.style.setProperty('--dBlue', "#D91604");
|
||||||
|
document.body.style.backgroundImage = "url('/static/images/Halloween.jpeg')";
|
||||||
|
}
|
||||||
init();
|
init();
|
||||||
}
|
}
|
|
@ -3,4 +3,6 @@
|
||||||
|
|
||||||
{% block container %}
|
{% block container %}
|
||||||
<h1>{{ current_user.username }}</h1>
|
<h1>{{ current_user.username }}</h1>
|
||||||
|
<h3>Themes</h3>
|
||||||
|
<p><a class="custom__themes">enable custom themes</a></p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue