Make pwa colors themeable

merge-requests/30/head
Bob Mottram 2022-02-27 10:23:07 +00:00
parent 0379733218
commit a6b4e612a7
17 changed files with 56 additions and 4 deletions

View File

@ -6873,10 +6873,29 @@ class PubServer(BaseHTTPRequestHandler):
cookie, calling_domain)
self.server.postreq_busy = False
def _progressive_web_app_manifest(self, calling_domain: str,
def _progressive_web_app_manifest(self, base_dir: str,
calling_domain: str,
getreq_start_time) -> None:
"""gets the PWA manifest
"""
pwa_theme_color = 'grey'
pwa_theme_background_color = 'black'
css_filename = base_dir + '/epicyon.css'
if os.path.isfile(css_filename):
css_str = ''
with open(css_filename, 'r') as fp_css:
css_str = fp_css.read()
if '--pwa-theme-color:' in css_str:
pwa_theme_color = css_str.split('--pwa-theme-color:')[1]
if ';' in pwa_theme_color:
pwa_theme_color = pwa_theme_color.split(';')[0].strip()
if '--pwa-theme-background-color:' in css_str:
pwa_theme_background_color = \
css_str.split('--pwa-theme-background-color:')[1]
if ';' in pwa_theme_background_color:
pwa_theme_background_color = \
pwa_theme_background_color.split(';')[0].strip()
app1 = "https://f-droid.org/en/packages/eu.siacs.conversations"
app2 = "https://staging.f-droid.org/en/packages/im.vector.app"
manifest = {
@ -6884,8 +6903,8 @@ class PubServer(BaseHTTPRequestHandler):
"short_name": "Epicyon",
"start_url": "/index.html",
"display": "standalone",
"background_color": "black",
"theme_color": "grey",
"background_color": pwa_theme_background_color,
"theme_color": pwa_theme_color,
"orientation": "portrait-primary",
"categories": ["microblog", "fediverse", "activitypub"],
"screenshots": [
@ -14045,7 +14064,8 @@ class PubServer(BaseHTTPRequestHandler):
if '/manifest.json' in self.path:
if self._has_accept(calling_domain):
if not self._request_http():
self._progressive_web_app_manifest(calling_domain,
self._progressive_web_app_manifest(self.server.base_dir,
calling_domain,
getreq_start_time)
return
else:

View File

@ -1,6 +1,8 @@
@charset "UTF-8";
:root {
--pwa-theme-color: apple-mobile-statusbar-color;
--pwa-theme-background-color: black-translucent;
--avatar-rounding: 10%;
--timeline-icon-width: 50px;
--timeline-icon-width-mobile: 100px;

View File

@ -1,4 +1,6 @@
{
"pwa-theme-color": "apple-mobile-statusbar-color",
"pwa-theme-background-color": "black-translucent",
"newswire-publish-icon": "True",
"full-width-timeline-buttons": "False",
"icons-as-buttons": "False",

View File

@ -1,4 +1,6 @@
{
"pwa-theme-color": "apple-mobile-statusbar-color",
"pwa-theme-background-color": "black-translucent",
"dropdown-fg-color": "#222",
"dropdown-bg-color": "white",
"dropdown-bg-color-hover": "lightgrey",

View File

@ -1,4 +1,6 @@
{
"pwa-theme-color": "apple-mobile-statusbar-color",
"pwa-theme-background-color": "black-translucent",
"dropdown-fg-color": "#9ad791",
"dropdown-bg-color": "#222",
"dropdown-bg-color-hover": "#444",

View File

@ -1,4 +1,6 @@
{
"pwa-theme-color": "apple-mobile-statusbar-color",
"pwa-theme-background-color": "black-translucent",
"dropdown-fg-color": "white",
"dropdown-bg-color": "#483335",
"dropdown-bg-color-hover": "#583335",

View File

@ -1,4 +1,6 @@
{
"pwa-theme-color": "apple-mobile-statusbar-color",
"pwa-theme-background-color": "black-translucent",
"dropdown-fg-color": "white",
"dropdown-bg-color": "#222",
"dropdown-bg-color-hover": "#444",

View File

@ -1,4 +1,6 @@
{
"pwa-theme-color": "apple-mobile-statusbar-color",
"pwa-theme-background-color": "black-translucent",
"dropdown-fg-color": "black",
"dropdown-bg-color": "#dedede",
"dropdown-bg-color-hover": "#ccc",

View File

@ -1,4 +1,6 @@
{
"pwa-theme-color": "apple-mobile-statusbar-color",
"pwa-theme-background-color": "black-translucent",
"dropdown-fg-color": "#33390d",
"dropdown-bg-color": "#9fb42b",
"dropdown-bg-color-hover": "#33390d",

View File

@ -1,4 +1,6 @@
{
"pwa-theme-color": "apple-mobile-statusbar-color",
"pwa-theme-background-color": "black-translucent",
"dropdown-fg-color": "#2d2c37",
"dropdown-bg-color": "#d6dbf0",
"dropdown-bg-color-hover": "#b6bbf0",

View File

@ -1,4 +1,6 @@
{
"pwa-theme-color": "apple-mobile-statusbar-color",
"pwa-theme-background-color": "black-translucent",
"dropdown-fg-color": "#0481f5",
"dropdown-bg-color": "#0d0d10",
"dropdown-bg-color-hover": "#0b0b10",

View File

@ -1,4 +1,6 @@
{
"pwa-theme-color": "apple-mobile-statusbar-color",
"pwa-theme-background-color": "black-translucent",
"dropdown-fg-color": "black",
"dropdown-bg-color": "#aba0d4",
"dropdown-bg-color-hover": "#cba0d4",

View File

@ -1,4 +1,6 @@
{
"pwa-theme-color": "apple-mobile-statusbar-color",
"pwa-theme-background-color": "black-translucent",
"dropdown-fg-color": "#f98bb0",
"dropdown-bg-color": "#2f152d",
"dropdown-bg-color-hover": "#3f152d",

View File

@ -1,4 +1,6 @@
{
"pwa-theme-color": "apple-mobile-statusbar-color",
"pwa-theme-background-color": "black-translucent",
"dropdown-fg-color": "white",
"dropdown-bg-color": "#002a3a",
"dropdown-bg-color-hover": "#025d84",

View File

@ -1,4 +1,6 @@
{
"pwa-theme-color": "apple-mobile-statusbar-color",
"pwa-theme-background-color": "black-translucent",
"dropdown-fg-color": "#2d2c37",
"dropdown-bg-color": "#ddd",
"dropdown-bg-color-hover": "#ccc",

View File

@ -1,4 +1,6 @@
{
"pwa-theme-color": "apple-mobile-statusbar-color",
"pwa-theme-background-color": "black-translucent",
"dropdown-fg-color": "#ffc4bc",
"dropdown-bg-color": "#1f0d10",
"dropdown-bg-color-hover": "#222",

View File

@ -1,4 +1,6 @@
{
"pwa-theme-color": "apple-mobile-statusbar-color",
"pwa-theme-background-color": "black-translucent",
"dropdown-fg-color": "#d5c7b7",
"dropdown-bg-color": "#4c4e41",
"dropdown-bg-color-hover": "#3c4e41",