Added dark-mode

This commit is contained in:
root 2023-06-03 15:30:12 +02:00
parent dd5b7f0e44
commit e73897d7a6
3 changed files with 7 additions and 2 deletions

View File

@ -5,6 +5,7 @@ base_url = https://ab.21x9.org
timezone = Europe/Berlin timezone = Europe/Berlin
mail = abgame@21x9.org mail = abgame@21x9.org
separator_char = ; separator_char = ;
theme = dark
[i18n] [i18n]
lang = de lang = de

View File

@ -63,7 +63,6 @@ def log_the_request(response):
def hello(): def hello():
lang = config.get('i18n', 'lang') lang = config.get('i18n', 'lang')
title = config.get('i18n', 'title') title = config.get('i18n', 'title')
mail = config.get('main', 'mail')
more = config.get('i18n', 'more') more = config.get('i18n', 'more')
desc = config.get('i18n', 'desc') desc = config.get('i18n', 'desc')
questions_prefix = config.get('i18n', 'questions_prefix') questions_prefix = config.get('i18n', 'questions_prefix')
@ -71,7 +70,9 @@ def hello():
send_questions = config.get('i18n', 'send_questions') send_questions = config.get('i18n', 'send_questions')
separator = config.get('i18n', 'separator') separator = config.get('i18n', 'separator')
separator_char = config.get('main', 'separator_char') separator_char = config.get('main', 'separator_char')
mail = config.get('main', 'mail')
url = config.get('main', 'base_url') url = config.get('main', 'base_url')
theme = config.get('main', 'theme')
ablines = [] ablines = []
now = datetime.now(tz=tz) now = datetime.now(tz=tz)
@ -93,7 +94,7 @@ def hello():
with open("ab.txt", "r") as f: with open("ab.txt", "r") as f:
num_lines = sum(1 for _ in f) num_lines = sum(1 for _ in f)
return render_template('index.html', title=title, separator=separator, content=ablines, num_lines=num_lines, epoch=epoch, mailto=mail, more=more, questions_prefix=questions_prefix, questions_suffix=questions_suffix, send_questions=send_questions, lang=lang, url=url, desc=desc) return render_template('index.html', title=title, separator=separator, content=ablines, num_lines=num_lines, epoch=epoch, mailto=mail, more=more, questions_prefix=questions_prefix, questions_suffix=questions_suffix, send_questions=send_questions, lang=lang, url=url, desc=desc, theme=theme)
def getContent(): def getContent():
lines = [a.strip() for a in open("ab.txt", "r").readlines()] lines = [a.strip() for a in open("ab.txt", "r").readlines()]

View File

@ -3,6 +3,9 @@
<head> <head>
<title>{{ title }}</title> <title>{{ title }}</title>
<link rel="stylesheet" type="text/css" href="/css/ab.css?t={{ epoch }}"> <link rel="stylesheet" type="text/css" href="/css/ab.css?t={{ epoch }}">
{%- if theme == "dark" %}
<link rel="stylesheet" type="text/css" href="/css/dark.css?t={{ epoch }}">
{%- endif %}
<link rel="apple-touch-icon" sizes="180x180" href="{{ url_for('static', filename='apple-touch-icon.png') }}"> <link rel="apple-touch-icon" sizes="180x180" href="{{ url_for('static', filename='apple-touch-icon.png') }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ url_for('static', filename='favicon-32x32.png') }}"> <link rel="icon" type="image/png" sizes="32x32" href="{{ url_for('static', filename='favicon-32x32.png') }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ url_for('static', filename='favicon-16x16.png') }}"> <link rel="icon" type="image/png" sizes="16x16" href="{{ url_for('static', filename='favicon-16x16.png') }}">