A free, self-hostable news aggregator…
Add: <meta name="theme-color"> (#5105)
maTh068d18b69bae
diff --git a/app/FreshRSS.php b/app/FreshRSS.phpindex 76ced841c..dd16fad6c 100644--- a/app/FreshRSS.php+++ b/app/FreshRSS.php@@ -141,6 +141,10 @@ class FreshRSS extends Minz_FrontController {FreshRSS_View::prependStyle(Minz_Url::display(FreshRSS::getThemeFileUrl($theme_id, $filename)));}}++ if (!empty($theme['theme-color'])) {+ FreshRSS_View::appendThemeColors($theme['theme-color']);+ }}//Use prepend to insert before extensions. Added in reverse order.if (Minz_Request::controllerName() !== 'index') {diff --git a/app/layout/layout.phtml b/app/layout/layout.phtmlindex 1e9ce6905..f0ade992f 100644--- a/app/layout/layout.phtml+++ b/app/layout/layout.phtml@@ -11,6 +11,7 @@ if (_t('gen.dir') === 'rtl') {<head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />+ <?= FreshRSS_View::metaThemeColor() ?><?= FreshRSS_View::headStyle() ?><script id="jsonVars" type="application/json"><?php $this->renderHelper('javascript_vars'); ?>diff --git a/lib/Minz/View.php b/lib/Minz/View.phpindex 459ef1e23..3b5052c36 100644--- a/lib/Minz/View.php+++ b/lib/Minz/View.php@@ -19,6 +19,7 @@ class Minz_View {private static $title = '';private static $styles = array ();private static $scripts = array ();+ private static $themeColors;private static $params = array ();@@ -237,6 +238,35 @@ class Minz_View {);}+ /**+ * @param array|string $themeColors+ */+ public static function appendThemeColors($themeColors): void {+ self::$themeColors = $themeColors;+ }++ /**+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color+ */+ public static function metaThemeColor(): string {+ $meta = '';++ if (!empty(self::$themeColors['light'])) {+ $meta .= '<meta name="theme-color" media="(prefers-color-scheme: light)" content="' . htmlspecialchars(self::$themeColors['light']) . '" />';+ }+ if (!empty(self::$themeColors['dark'])) {+ $meta .= '<meta name="theme-color" media="(prefers-color-scheme: dark)" content="' . htmlspecialchars(self::$themeColors['dark']) . '" />';+ }+ if (!empty(self::$themeColors['default'])) {+ $meta .= '<meta name="theme-color" content="' . htmlspecialchars(self::$themeColors['default']) . '" />';+ }+ if (empty(self::$themeColors['default']) && !empty(self::$themeColors) && empty(self::$themeColors['light']) && empty(self::$themeColors['dark'])) {+ $meta .= '<meta name="theme-color" content="' . htmlspecialchars(self::$themeColors) . '" />';+ }++ return $meta;+ }+/*** Gestion des scripts JS*/diff --git a/p/themes/Alternative-Dark/metadata.json b/p/themes/Alternative-Dark/metadata.jsonindex 707ed1da5..99f13b549 100644--- a/p/themes/Alternative-Dark/metadata.json+++ b/p/themes/Alternative-Dark/metadata.json@@ -3,5 +3,6 @@"author": "Ghost","description": "Save my eyes!!!","version": 0.1,- "files": ["_frss.css", "adark.css"]+ "files": ["_frss.css", "adark.css"],+ "theme-color": "#171717"}diff --git a/p/themes/Ansum/metadata.json b/p/themes/Ansum/metadata.jsonindex 23b1a96cc..ab2359967 100644--- a/p/themes/Ansum/metadata.json+++ b/p/themes/Ansum/metadata.json@@ -3,5 +3,6 @@"author": "Thomas Guesnon","description": "Thème sablonneux","version": 0.1,- "files": ["_frss.css", "ansum.css"]+ "files": ["_frss.css", "ansum.css"],+ "theme-color": "#fbf9f6"}diff --git a/p/themes/BlueLagoon/metadata.json b/p/themes/BlueLagoon/metadata.jsonindex 37750c631..5540187ab 100644--- a/p/themes/BlueLagoon/metadata.json+++ b/p/themes/BlueLagoon/metadata.json@@ -4,5 +4,6 @@"description": "C’est un cocktail (bis)! C’est la version plus fresh de Screwdriver. C’est… c’est… un thème pour l’agrégateur de flux RSS FreshRSS. En toute modestie, ce thème tue du Nyan Cat.","version": 1.0,"files": ["_frss.css","BlueLagoon.css"],- "deprecated": true+ "deprecated": true,+ "theme-color": "#fefefd"}diff --git a/p/themes/Dark-pink/metadata.json b/p/themes/Dark-pink/metadata.jsonindex 7e582eefd..b76c73da1 100644--- a/p/themes/Dark-pink/metadata.json+++ b/p/themes/Dark-pink/metadata.json@@ -3,5 +3,6 @@"author": "Miicat_47","description": "Nice dawk pink theme. >_< UwU","version": 0.1,- "files": ["_frss.css", "../Alternative-Dark/adark.css", "pinkdark.css"]+ "files": ["_frss.css", "../Alternative-Dark/adark.css", "pinkdark.css"],+ "theme-color": "#171717"}diff --git a/p/themes/Dark/metadata.json b/p/themes/Dark/metadata.jsonindex b38428995..19a2287a6 100644--- a/p/themes/Dark/metadata.json+++ b/p/themes/Dark/metadata.json@@ -3,5 +3,6 @@"author": "AD","description": "The dark side of the “Origine” theme","version": 0.2,- "files": ["_frss.css", "dark.css"]+ "files": ["_frss.css", "dark.css"],+ "theme-color": "#111111"}diff --git a/p/themes/Flat/metadata.json b/p/themes/Flat/metadata.jsonindex bd7ce6157..acb9b0668 100644--- a/p/themes/Flat/metadata.json+++ b/p/themes/Flat/metadata.json@@ -4,5 +4,6 @@"description": "Thème plat pour FreshRSS","version": 0.2,"files": ["_frss.css", "flat.css"],- "deprecated": true+ "deprecated": true,+ "theme-color": "#34495e"}diff --git a/p/themes/Mapco/metadata.json b/p/themes/Mapco/metadata.jsonindex 353d0908a..e22a7875b 100644--- a/p/themes/Mapco/metadata.json+++ b/p/themes/Mapco/metadata.json@@ -3,5 +3,6 @@"author": "Thomas Guesnon","description": "Thème pour FreshRSS","version": 0.1,- "files": ["_frss.css", "mapco.css"]+ "files": ["_frss.css", "mapco.css"],+ "theme-color": "#303136"}diff --git a/p/themes/Nord/metadata.json b/p/themes/Nord/metadata.jsonindex eeb9ef808..07fd420d3 100644--- a/p/themes/Nord/metadata.json+++ b/p/themes/Nord/metadata.json@@ -3,5 +3,6 @@"author": "joelchrono12","description": "A simple theme based on Nord's color scheme","version": 0.1,- "files": ["_frss.css","nord.css"]+ "files": ["_frss.css","nord.css"],+ "theme-color": "#2e3440"}diff --git a/p/themes/Origine-compact/metadata.json b/p/themes/Origine-compact/metadata.jsonindex ded2f0616..acc5caa1d 100644--- a/p/themes/Origine-compact/metadata.json+++ b/p/themes/Origine-compact/metadata.json@@ -3,5 +3,6 @@"author": "Kevin Papst","description": "A theme that tries to use the screen size more efficiently, based on Origine","version": 0.1,- "files": ["_frss.css", "../Origine/origine.css", "origine-compact.css"]+ "files": ["_frss.css", "../Origine/origine.css", "origine-compact.css"],+ "theme-color": {"dark": "#1f1f1f", "light": "#f0f0f0"}}diff --git a/p/themes/Origine/metadata.json b/p/themes/Origine/metadata.jsonindex 721f9af8b..7b0bbd7af 100644--- a/p/themes/Origine/metadata.json+++ b/p/themes/Origine/metadata.json@@ -3,5 +3,6 @@"author": "Marien Fressinaud","description": "Le thème par défaut pour FreshRSS","version": 0.2,- "files": ["_frss.css", "origine.css"]+ "files": ["_frss.css", "origine.css"],+ "theme-color": {"dark": "#1f1f1f", "light": "#f0f0f0"}}diff --git a/p/themes/Pafat/metadata.json b/p/themes/Pafat/metadata.jsonindex f70442378..355d5bfc0 100644--- a/p/themes/Pafat/metadata.json+++ b/p/themes/Pafat/metadata.json@@ -3,5 +3,6 @@"author": "Plopoyop","description": "Un thème pour FreshRSS","version": 0.2,- "files": ["_frss.css", "pafat.css"]+ "files": ["_frss.css", "pafat.css"],+ "theme-color": "#f4f4f4"}diff --git a/p/themes/Screwdriver/metadata.json b/p/themes/Screwdriver/metadata.jsonindex 8da73f80c..87deba45a 100644--- a/p/themes/Screwdriver/metadata.json+++ b/p/themes/Screwdriver/metadata.json@@ -4,5 +4,6 @@"description": "C’est un cocktail ! C’est chaud mais « fresh » à la fois. Ce thème tue du chaton.","version": 1.1,"files": ["_frss.css","screwdriver.css"],- "deprecated" : true+ "deprecated" : true,+ "theme-color": "#fefefe"}diff --git a/p/themes/Swage/metadata.json b/p/themes/Swage/metadata.jsonindex d51b026cc..f9aded562 100644--- a/p/themes/Swage/metadata.json+++ b/p/themes/Swage/metadata.json@@ -3,5 +3,6 @@"author": "Patrick Crandol","description": "A Fresh take on the interface, inspired by the Flat Theme.","version": 1.0,- "files": ["_frss.css", "swage.css"]+ "files": ["_frss.css", "swage.css"],+ "theme-color": "#22303d"}diff --git a/p/themes/base-theme/metadata.json b/p/themes/base-theme/metadata.jsonindex 8ba17b101..8abbdc230 100644--- a/p/themes/base-theme/metadata.json+++ b/p/themes/base-theme/metadata.json@@ -3,5 +3,6 @@"author": "Your name","description": "A wonderful base theme","version": 0.1,- "files": ["frss.css", "base.css"]+ "files": ["frss.css", "base.css"],+ "theme-color": "#123456"}