Homepage/ezgg_website/__init__.py
2024-06-02 17:17:53 +02:00

163 lines
4.7 KiB
Python

from __future__ import annotations
from pathlib import Path
import rio
from from_root import from_root
from . import pages
from . import components as comps
from . import services
rio.Icon.register_single_icon(
set_name="custom",
icon_name="steam",
icon_source=from_root("ezgg_website/assets/icons/steam.svg")
)
themes = [
# Grey/Purple
rio.Theme.from_colors(
primary_color=rio.Color.from_hex("bb86fc"),
secondary_color=rio.Color.from_hex("6200ee"),
neutral_color=rio.Color.from_hex("1e1e1e"),
background_color=rio.Color.from_hex("121212"),
hud_color=rio.Color.from_hex("bb86fc"),
text_color=rio.Color.from_hex("FFFFFF"),
light=False,
),
# Grey/Turquoise
rio.Theme.from_colors(
primary_color=rio.Color.from_hex("03dac5"),
secondary_color=rio.Color.from_hex("018786"),
neutral_color=rio.Color.from_hex("1e1e1e"),
background_color=rio.Color.from_hex("121212"),
hud_color=rio.Color.from_hex("03dac5"),
text_color=rio.Color.from_hex("FFFFFF"),
light=False,
),
# Grey/Pink
rio.Theme.from_colors(
primary_color=rio.Color.from_hex("fe1f70"),
secondary_color=rio.Color.from_hex("a32263"),
neutral_color=rio.Color.from_hex("1e1e1e"),
background_color=rio.Color.from_hex("121212"),
hud_color=rio.Color.from_hex("fe1f70"),
text_color=rio.Color.from_hex("FFFFFF"),
light=False,
),
# Grey/Red
rio.Theme.from_colors(
primary_color=rio.Color.from_hex("ec1e2a"),
secondary_color=rio.Color.from_hex("9b1725"),
neutral_color=rio.Color.from_hex("1e1e1e"),
background_color=rio.Color.from_hex("121212"),
hud_color=rio.Color.from_hex("ec1e2a"),
text_color=rio.Color.from_hex("FFFFFF"),
light=False,
),
# Grey/Orange
rio.Theme.from_colors(
primary_color=rio.Color.from_hex("ff800d"),
secondary_color=rio.Color.from_hex("ae5714"),
neutral_color=rio.Color.from_hex("1e1e1e"),
background_color=rio.Color.from_hex("121212"),
hud_color=rio.Color.from_hex("ff800d"),
text_color=rio.Color.from_hex("FFFFFF"),
light=False,
),
# Grey/Blue
rio.Theme.from_colors(
primary_color=rio.Color.from_hex("2c89ff"),
secondary_color=rio.Color.from_hex("2376dc"),
neutral_color=rio.Color.from_hex("1e1e1e"),
background_color=rio.Color.from_hex("121212"),
hud_color=rio.Color.from_hex("2c89ff"),
text_color=rio.Color.from_hex("FFFFFF"),
light=False,
),
# Turquoise - Dark
rio.Theme.from_colors(
primary_color=rio.Color.from_hex("03dac5"),
secondary_color=rio.Color.from_hex("018786"),
neutral_color=rio.Color.from_hex("1e1e1e"),
background_color=rio.Color.from_hex("121212"),
hud_color=rio.Color.from_hex("03dac5"),
text_color=rio.Color.from_hex("FFFFFF"),
light=False,
),
# Turquoise - Light
rio.Theme.from_colors(
primary_color=rio.Color.from_hex("03dac5"),
secondary_color=rio.Color.from_hex("018786"),
neutral_color=rio.Color.from_hex("FFFFFF"),
background_color=rio.Color.from_hex("FFFFFF"),
hud_color=rio.Color.from_hex("03dac5"),
text_color=rio.Color.from_hex("000000"),
light=True,
)
]
async def on_session_start(s: rio.Session) -> None:
print(from_root("ezgg_website/assets/icons/favicon.png"))
await s.set_title("EZ GG e.V.")
# Create the Rio app
database_service = services.DatabaseService()
app = rio.App(
name='ezgg-website',
pages=[
rio.Page(
name="Home",
page_url='',
build=pages.Home,
),
rio.Page(
name="About",
page_url='about',
build=pages.About,
),
rio.Page(
name="Member",
page_url='member',
build=pages.Member,
),
rio.Page(
name="Constitution",
page_url='constitution',
build=pages.Constitution,
),
rio.Page(
name="Join",
page_url='join',
build=pages.Join,
),
rio.Page(
name="Pics",
page_url='pics',
build=pages.Pics,
),
rio.Page(
name="Imprint",
page_url='imprint',
build=pages.Imprint,
),
rio.Page(
name="Privacy",
page_url='privacy',
build=pages.Privacy,
)
],
theme=themes[6],
icon=from_root("ezgg_website/assets/icons/favicon.png"),
assets_dir=Path(__file__).parent / "assets",
on_session_start=on_session_start,
default_attachments=[database_service]
)