Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add darkmode accross site #11

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
207 changes: 189 additions & 18 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,27 @@
name="description"
content="Oblivion-Inverse : A Simple E-Mail Tracker"
/>
<link rel="apple-touch-icon" href="{{ url_for('static', filename = 'logo192.png') }}" />
<link rel="manifest" href="{{ url_for('static', filename = 'manifest.json') }}" />
<script
src="https://kit.fontawesome.com/76b066ae7b.js"
crossorigin="anonymous"
></script>
<link
rel="apple-touch-icon"
href="{{ url_for('static', filename = 'logo192.png') }}"
/>
<link
rel="manifest"
href="{{ url_for('static', filename = 'manifest.json') }}"
/>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/css/bulma.min.css"
/>
<link rel="shortcut icon" href="/assets/favicon.ico" />
<link
href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet"
/>

<title>.: Oblivion-Inverse :.</title>
</head>
Expand All @@ -28,8 +43,10 @@
>
<div class="navbar-brand">
<a href="{{ url_for('index') }}">
<h1 class="title" style="margin: 5px 10px 2px;">Oblivion<sup>-1</sup></h1>
</a>
<h1 class="title" style="margin: 5px 10px 2px">
Oblivion<sup>-1</sup>
</h1>
</a>
<a
role="button"
class="navbar-burger"
Expand All @@ -47,16 +64,34 @@ <h1 class="title" style="margin: 5px 10px 2px;">Oblivion<sup>-1</sup></h1>
<div id="navbarBasic" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item" href="{{ url_for('tracklist') }}">
<span id="t-1" class="navbar-item" style="margin: 5px 0px 0px;"> Tracking List </span>
<span id="t-1" class="navbar-item" style="margin: 5px 0px 0px">
Tracking List
</span>
</a>
{% if current_user.is_authenticated %}
<a class="navbar-item" href="{{ url_for('index') }}">
<span id="t-1" class="navbar-item" style="margin: 5px 0px 0px"
>Add E-Mail
</span>
</a>
<a class="navbar-item" href="{{ url_for('logout') }}">
<span id="t-1" class="navbar-item" style="margin: 5px 0px 0px;"> Log out </span>
<span id="t-1" class="navbar-item" style="margin: 5px 0px 0px">
Log out
</span>
</a>

{% endif %}
</div>

<div class="navbar-end">
<div class="select">
<i class="material-icons">palette</i>
<select class="select__input" id="selTheme">
<option value="auto">Auto</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</div>
<a
id="t-3"
class="navbar-item"
Expand Down Expand Up @@ -85,8 +120,7 @@ <h1 class="title" style="margin: 5px 10px 2px;">Oblivion<sup>-1</sup></h1>
</p>
</div>
</div>
{% endfor %} {% endif %} {% endwith %}
{% block main %} {% endblock %}
{% endfor %} {% endif %} {% endwith %} {% block main %} {% endblock %}

<script
type="module"
Expand All @@ -97,27 +131,164 @@ <h1 class="title" style="margin: 5px 10px 2px;">Oblivion<sup>-1</sup></h1>
src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.js"
></script>

<script type = "text/javascript">
function managePane(){
var burger = document.querySelector('.navbar-burger');
var nav = document.querySelector('#navbarBasic');
burger.classList.toggle('is-active');
nav.classList.toggle('is-active')
<script type="text/javascript">
function managePane() {
var burger = document.querySelector(".navbar-burger");
var nav = document.querySelector("#navbarBasic");
burger.classList.toggle("is-active");
nav.classList.toggle("is-active");
}

function applyTheme(theme) {
document.body.classList.remove(
"theme-auto",
"theme-light",
"theme-dark"
);
document.body.classList.add(`theme-${theme}`);
}

document.addEventListener("DOMContentLoaded", () => {
const savedTheme = localStorage.getItem("theme") || "auto";

applyTheme(savedTheme);

for (const optionElement of document.querySelectorAll(
"#selTheme option"
)) {
optionElement.selected = savedTheme === optionElement.value;
}

document
.querySelector("#selTheme")
.addEventListener("change", function () {
localStorage.setItem("theme", this.value);
applyTheme(this.value);
});
});
</script>

<style>
html{
background-color: #C7F8CA;
html {
background-color: #c7f8ca;
height: 100%;
}
.navbar{
.navbar {
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
margin-left: 5px;
margin-right: 5px;
overflow: hidden;
}
</style>

:root {
--dark-background-color: #111111;
--dark-background-color-alt: #222222;
--dark-trim-color: #333333;
--dark-text-color: #eeeeee;
}

body {
/* Light Theme */
--background-color: #c7f8ca;
--background-color-alt: #c7f8ca;
--trim-color: #dddddd;
--text-color: #333333;

--primary-color: #009578;
--font-family: "Quicksand", sans-serif;
height: 100%;
width: 100%;
color: var(--text-color);
font-family: var(--font-family);
background: var(--background-color);
}

body.theme-dark {
--background-color: var(--dark-background-color);
--background-color-alt: var(--dark-background-color-alt);
--trim-color: var(--dark-trim-color);
--text-color: var(--dark-text-color);
}

@media (prefers-color-scheme: dark) {
body.theme-auto {
--background-color: var(--dark-background-color);
--background-color-alt: var(--dark-background-color-alt);
--trim-color: var(--dark-trim-color);
--text-color: var(--dark-text-color);
}
}

.header {
display: flex;
justify-content: space-between;
box-sizing: border-box;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 60px;
padding: 10px;
background: var(--background-color-alt);
border-bottom: 1px solid var(--trim-color);
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}

.header__logo {
height: 100%;
}

.header__button {
background: none;
border: none;
outline: none;
}

.header > *:not(:last-child) {
margin-right: 10px;
}

.main {
margin: 0 auto;
max-width: 1000px;
padding: 25px;
}

.main p {
line-height: 1.6;
font-weight: 500;
}

.select {
margin-top: 0.7em;
display: inline-flex;
justify-content: space-evenly;
align-items: center;
padding: 5px 8px;
border-radius: 10px;
}

.select__input {
-webkit-appearance: none;
-moz-appearance: none;
padding: 7px 14px;
background: none;
border: none;
outline: none;
cursor: pointer;
color: var(--text-color);
font-weight: 500;
font-family: var(--font-family);
}

.select__input option {
color: #000000;
}

.material-icons{
margin-right:0.5em ;
}
</style>
</body>
</html>