Compare commits

..

4 commits

Author SHA1 Message Date
75bf2bb0e1
hide vscode folder 2022-10-07 01:00:07 +02:00
03122a8617
use custom font 2022-10-07 00:59:40 +02:00
52eefa98fa
rot13 easteregg 2022-10-07 00:08:54 +02:00
1ad14ffa7f
add some colors 2022-10-07 00:08:46 +02:00
6 changed files with 108 additions and 12 deletions

4
.gitignore vendored
View file

@ -4,3 +4,7 @@ lib64
pyvenv.cfg pyvenv.cfg
__pycache__/ __pycache__/
.vscode/
src/public/fonts/

View file

@ -1 +1,2 @@
Flask==2.2.2 Flask==2.2.2
requests==2.28.1

View file

@ -1,18 +1,15 @@
from routes.index import router as index
from flask import Flask, redirect from flask import Flask, redirect
from font import init as init_font
from routes.index import router as index
app = Flask(__name__, static_url_path="/", static_folder="public") app = Flask(__name__, static_url_path="/", static_folder="public")
app.register_blueprint(index, url_prefix="/index") app.register_blueprint(index, url_prefix="/index")
init_font("1.3.0")
@app.route("/") @app.route("/")
def root(): def root():
return redirect("index") return redirect("index")
class AttributeDict(dict):
def __getattr__(self, name):
if name in self:
return self[name]
raise AttributeError(name)

37
src/font.py Normal file
View file

@ -0,0 +1,37 @@
from os import mkdir
from requests import get
def exist(path):
"""Check if file or directory exists"""
try:
open(path, "r")
except FileNotFoundError:
return False # Doesn't exist
except IsADirectoryError:
return True # Directory exists
else:
return True # File exists
def init(version):
""" Download font """
path = "./src/public/fonts"
filename = "RiluRegular.ttf"
# If there is filename changes, you should change
# the name in the css file too (./src/public/styles/style.css)
# Check if fonts directory exists
if not exist(path):
mkdir(path)
# Download the font file if needed
if not exist(f"{path}/{filename}"):
# Download the font file
file_url = f"https://github.com/alisinisterra/rilu/releases/download/v{version}/{filename}"
data = get(file_url).content
# Save the file
with open(f"{path}/{filename}", "wb") as file:
file.write(data)

View file

@ -1,3 +1,48 @@
@font-face {
font-family: Rilu;
font-style: normal;
font-weight: normal;
src: url(../fonts/RiluRegular.ttf);
}
/* https://www.colorhexa.com/c2b280 */
@media (prefers-color-scheme: light) {
:root {
--bg-color: rgb(245, 242, 234);
--text-color: rgb(6, 5, 3);
--selection: rgb(232, 226, 208);
--link-color: rgb(13, 71, 161);
--link-color-hover: rgb(181, 162, 101);
--grey: rgb(207, 216, 220);
--shadow: rgba(0, 0, 0, 0.5);
}
}
@media (prefers-color-scheme: dark) {
:root {
--bg-color: rgb(19, 16, 9);
--text-color: rgb(251, 250, 247);
--selection: rgb(226, 218, 194);
--link-color: rgb(100, 181, 246);
--link-color-hover: rgb(175, 154, 88);
--grey: rgb(55, 71, 79);
--shadow: rgba(125, 109, 60, 0.288);
}
}
::selection {
color: rgb(0, 0, 0);
background: var(--selection);
}
html {
background-color: var(--bg-color);
color: var(--text-color);
font-family: Rilu;
font-size: 17px;
scroll-behavior: smooth;
}
.text-center { .text-center {
text-align: center; text-align: center;
} }
@ -5,3 +50,17 @@
header > .text-title { header > .text-title {
font-size: 2.5rem; font-size: 2.5rem;
} }
main {
margin-left: auto;
margin-right: auto;
margin-top: 2%;
padding: 0.9% 0.9% 0.9% 0.9%;
width: 42%;
border-radius: 6px;
border: 1px solid rgb(170, 170, 170);
text-align: center;
border-radius: 8px;
box-shadow: 0 4px 30px 0 var(--shadow), 0 4px 30px 0 var(--shadow);
}

View file

@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ name }} - Index</title> <title>{{ name }}</title>
<link rel="stylesheet" href="../styles/style.css" /> <link rel="stylesheet" href="../styles/style.css" />
</head> </head>
@ -18,8 +18,6 @@
<p>placeholder-main</p> <p>placeholder-main</p>
</main> </main>
<footer> <footer>NPNO</footer>
<p>placeholder-footer</p>
</footer>
</body> </body>
</html> </html>