From 068d18b69bae8456669293a8b7dfe9afd827e03d Mon Sep 17 00:00:00 2001 From: maTh Date: Sat, 4 Mar 2023 15:05:58 +0100 Subject: Add: (#5105) * implemented * themes' metadata.json * fix * fix * retrigger tests * Update lib/Minz/View.php Co-authored-by: Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com> * Update lib/Minz/View.php Co-authored-by: Alexandre Alapetite * Update lib/Minz/View.php Co-authored-by: Alexandre Alapetite * Update lib/Minz/View.php Co-authored-by: Alexandre Alapetite * fix --------- Co-authored-by: Alexandre Alapetite Co-authored-by: Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com> --- lib/Minz/View.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'lib/Minz/View.php') diff --git a/lib/Minz/View.php b/lib/Minz/View.php index 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 .= ''; + } + if (!empty(self::$themeColors['dark'])) { + $meta .= ''; + } + if (!empty(self::$themeColors['default'])) { + $meta .= ''; + } + if (empty(self::$themeColors['default']) && !empty(self::$themeColors) && empty(self::$themeColors['light']) && empty(self::$themeColors['dark'])) { + $meta .= ''; + } + + return $meta; + } + /** * Gestion des scripts JS */ -- cgit v1.2.3